Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Convert local time to UTC based on offset

Author  Topic 

alasse130
Starting Member

21 Posts

Posted - 2011-08-10 : 01:34:53
Hi experts, can someone tell me how to convert a local time to utc? Basically, we have a table with different timezones and each corresponding timezone offsets. What will be the correct sql statement to convert to utc making use of the timezone offset?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-10 : 07:42:12
what does the offset field store? second/minute or hour value?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

alasse130
Starting Member

21 Posts

Posted - 2011-08-10 : 16:00:51
Minutes
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-08-10 : 16:12:41
SQL has built in functions for that. But, basically, you should just need to use the DATEADD function. If you are having trouble, follow this link to provide more information so we cna help you better:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -