SQL Server Developer Center > SQL Server Forums > SQL Server Notification Services > How is UtcOffset stored in NSTimeZones table?
Ask a questionAsk a question
 

AnswerHow is UtcOffset stored in NSTimeZones table?

  • Friday, September 04, 2009 5:58 AMsaba khan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi!!

    I wanted to know what is the unit of UtcOffset which are stored in the NSTimeZones table?

    I want to convert some other timezones to UTC say for example:

    I want to convert India Time to UTC but I am not sure that where should I add the UTCoffset value to other time zone.. for a while I assumed that in millisecond but it is giving me the wrong conversion result:

    Like I queried the sql browser in this way:
    select DateADD(millisecond, 5940000, GetDate()) 'LocalToUTC', GetUTCDate() 'UTC'  

    where 5940000 is the value for UtcOffset columne stored for India Time Timezone in NSTimeZones and my server timezone has set to India time so GetDate() will return me the datetime value in Indian Time and I am adding its UtcOffset to get it converted into UTC and so should get matched up with GetUTCDate() and show the same result. but it is showing me different .. see for ex

    LocalToUTC = 2009-09-04 13:01:30.867
    UTC = 2009-09-04 05:52:30.867

    I am using this data in my application and we are giving the user to select their choice of timezone from drop-down(contain timezones from NSTimeZones table) irrespective of their local time zone set into the machine. And then we have to convert the selected timezone date time to UTC to save it in database. That's the reason i need to handle this scenario in my stored procedure while inserting it ...

    Please help me and please try to treat this as an urgent.

    Thank a lot for reading it!!
    Saba
    fksaba@gmail.com

Answers

All Replies