Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #936

Re: Datetime with timezone information in it?

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Datetime with timezone information in it?
Date 2012-03-02 10:37 +0000
Organization Erland Sommarskog
Message-ID <XnsA00A763728520Yazorman@127.0.0.1> (permalink)
References <m3d38v5r9t.fsf@muikku.katiska.org>

Show all headers | View raw


Antti Järvinen (costello@iki.fi) writes:
> I tried briefly looking through docs but I could not find definite answer: 
> is there database column datatype that would save date, time and the 
> timezone as a single value? I have an app that is supposed to run 24/7 
> and having those daylight saving timezone-changes occurring twice a 
> year hoses up couple of things twice a year.
> 
> I still have the (good) option of saving time info as seconds since
> beginning of year 1970 and having timezone conversions done at client
> end but that's not that convenient -> what is the correct way to handle 
> this around with ms sql server (clients will be .net and asp.net
> thingies). 
> The DATETIMEOFFSET of 2008 version did not look too handy to me, 
> anything else? 
 
What's wrong with datetimeoffset? It is not DST-aware in the sense
that if you do dateadd(MONTH, 6, sysdatetimeoffset()) you will get a 
value where the timezone part is +02:00, although you will be in 
+03:00 at that point. But apart from that it should work.


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Datetime with timezone information in it? Antti J=?iso-8859-1?B?5A==?=rvinen <costello@iki.fi> - 2012-03-02 10:41 +0200
  Re: Datetime with timezone information in it? Erland Sommarskog <esquel@sommarskog.se> - 2012-03-02 10:37 +0000
    Re: Datetime with timezone information in it? Antti J=?iso-8859-1?B?5A==?=rvinen <costello@iki.fi> - 2012-03-02 15:46 +0200
      Re: Datetime with timezone information in it? Erland Sommarskog <esquel@sommarskog.se> - 2012-03-02 17:22 +0000
        Re: Datetime with timezone information in it? Justin <kfwolf@hotmail.com> - 2012-03-08 06:37 -0800

csiph-web