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?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Datetime with timezone information in it?
Date Fri, 2 Mar 2012 10:37:12 +0000 (UTC)
Organization Erland Sommarskog
Lines 28
Message-ID <XnsA00A763728520Yazorman@127.0.0.1> (permalink)
References <m3d38v5r9t.fsf@muikku.katiska.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Date Fri, 2 Mar 2012 10:37:12 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="v1P300f0mDXpBZGzT/9PAw"; logging-data="31847"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qSheV1Qb69B5z8p6jVUJg"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:5F1NfvXkBGK2pmMiYZOnoE3bYBo=
Xref csiph.com comp.databases.ms-sqlserver:936

Show key headers only | 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