Monday, March 19, 2012

convert UTC date

hi- i'm working with a database that stores dates in UTC format. does
anyone know of, or have, a function to convert from this format?
tia,
jtWell, what is your offset from UTC?
DECLARE @.offset TINYINT;
SET @.offset = ?;
SELECT DATEADD(HOUR, @.offset, datetimeColumn) FROM table;
If you participate in daylight savings time, you will be much better off
using a calendar table.
http://www.aspfaq.com/2519
And yes, I need to update the article to account for the change in DST
timeframes here in the US, that take effect this year IIRC.
A
"JTL" <jliautaud@.hotmail.com> wrote in message
news:OBHy0SuFGHA.1192@.TK2MSFTNGP11.phx.gbl...
> hi- i'm working with a database that stores dates in UTC format. does
> anyone know of, or have, a function to convert from this format?
> tia,
> jt
>|||ok- thanks for the help-
this database stores the number of seconds that have passed since 1/1/1970,
as an integer field. so how do i convert that to the current date?
jt
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23bQMScuFGHA.3532@.TK2MSFTNGP14.phx.gbl...
> Well, what is your offset from UTC?
> DECLARE @.offset TINYINT;
> SET @.offset = ?;
> SELECT DATEADD(HOUR, @.offset, datetimeColumn) FROM table;
> If you participate in daylight savings time, you will be much better off
> using a calendar table.
> http://www.aspfaq.com/2519
> And yes, I need to update the article to account for the change in DST
> timeframes here in the US, that take effect this year IIRC.
> A
>
> "JTL" <jliautaud@.hotmail.com> wrote in message
> news:OBHy0SuFGHA.1192@.TK2MSFTNGP11.phx.gbl...
>|||http://www.aspfaq.com/2451
As an aside, you may want to use BIGINT, if you ever want to store dates
beyond 2038-01-18.
A
"JTL" <jliautaud@.hotmail.com> wrote in message
news:%23YXLk0uFGHA.3856@.TK2MSFTNGP12.phx.gbl...
> ok- thanks for the help-
> this database stores the number of seconds that have passed since
> 1/1/1970, as an integer field. so how do i convert that to the current
> date?
> jt
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:%23bQMScuFGHA.3532@.TK2MSFTNGP14.phx.gbl...
>|||thank you- big help!
jt
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:upmrY3uFGHA.2704@.TK2MSFTNGP15.phx.gbl...
> http://www.aspfaq.com/2451
> As an aside, you may want to use BIGINT, if you ever want to store dates
> beyond 2038-01-18.
> A
>
>
> "JTL" <jliautaud@.hotmail.com> wrote in message
> news:%23YXLk0uFGHA.3856@.TK2MSFTNGP12.phx.gbl...
>

No comments:

Post a Comment