SQL Server Developer Center >
SQL Server Forums
>
SQL Server Notification Services
>
How is UtcOffset stored in NSTimeZones table?
How is UtcOffset stored in NSTimeZones table?
- 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
- Hi,
The UTC offset value is the number of SqlDateTime data-type clock "ticks" between UTC and the time zone. To obtain the number of hours between UTC and the time zone, divide the UTC offset value by 1080000.
For more information, see:
http://msdn.microsoft.com/en-us/library/ms145276(SQL.90).aspx
Thanks.
Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked As Answer byNai-dong Jin - MSFTMSFT, ModeratorThursday, September 10, 2009 3:40 AM
All Replies
- Hi,
The UTC offset value is the number of SqlDateTime data-type clock "ticks" between UTC and the time zone. To obtain the number of hours between UTC and the time zone, divide the UTC offset value by 1080000.
For more information, see:
http://msdn.microsoft.com/en-us/library/ms145276(SQL.90).aspx
Thanks.
Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked As Answer byNai-dong Jin - MSFTMSFT, ModeratorThursday, September 10, 2009 3:40 AM


