UTC date conversion

  • Hi all!

    I am trying to convert a UTC date to local time.

    The UTC date is stored in the database for each transaction and it is in integer.

    The problem is when we switch from Eastern Daylight Savings Time to Eastern Standard Time. I need to be able to determine at what point was the UTC date saved at, either Easter daylight or Eastern Standard, so that I can apply the appropriate formula.

    Thanks for your input.

  • This was removed by the editor as SPAM

  • Maybe you can query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. There you should find the information you need to do your calculation.

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I am faced with the same problem of converting UTC to local time. All my date/time values are stored in UTC in the database. I would like a function like:

    LocalTime = UTC2Local(UTCCol[,TZ])

    I have tried creating one but always run intothe problem of knowing the offset that was in effect for the data value in UTCCol. I may have to create a table with offsets based on date/time ranges. But this seems like an unacceptable dependancy. The table has to exist and be populated with the values for all possible dates. Any help would be appreciated.

    quote:


    Maybe you can query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. There you should find the information you need to do your calculation.

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de



    Mike

  • select getdate() as Currenttime

    select GETUTCDATE() as CurrentUTCtime

    select dateadd(hour, 5, getdate()) as CurrentUTCtime

    Hope that these samples could help u

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply