SQL Server Performance

anyone have UTC knowledge?

Discussion in 'ALL SQL SERVER QUESTIONS' started by MichaelB, Mar 7, 2012.

  1. MichaelB Member

    I have a DB that has had dates stored in UTC by an application.
    My question is how do I convert a HISTORIC UTC date to reflect the datetime locally. I know that I can get the current offset and do that but I need the offset based on the date passed in. even if it was created before the change in daylight savings times years ago (when G Bush changed the dates) it needs to display the actual datetime at that moment in history.. how??
  2. Orlando Colamatteo New Member

    I would recommend creating a table to hold the relevant time zone offsets for the relevant time period to use in your conversion effort.

    Time zone info: http://www.twinsun.com/tz/tz-link.htm

    Once you have a reference table setup you can use the DATEADD function to change the UTC time to the local time zone and store as necessary.
  3. Shehap MVP, MCTS, MCITP SQL Server

    I do prefer to use that new 2008 features (Datetimoffset) where You could use that new 2008 data type uisng function SWITCHOFFSET() to interrelate it easily with that tables of Time zones suggested above
  4. MichaelB Member

    unfortunately it is SQL 2005 currently. It is being upgraded this year however!
    We did get a workaround and all is well. Thanks for the info!

Share This Page