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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Store date in GMT
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

146 Posts

Posted - 08/25/2010 :  16:26:16  Show Profile  Reply with Quote
If I'm passing in a date to a query, can I convert it to GMT in SQL?

Something like:

INSERT INTO tblTest (Date)
VALUES (GMT(@mydate))

Patron Saint of Lost Yaks

30421 Posts

Posted - 08/25/2010 :  16:40:13  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Only if you know the timezone for which the date and time is entered.
Then use DATEADD(HOUR, +/-x, OriginalDateTime) to calculate the GMT.

Or, if you are using SQL Server 2008 or later, use DATETIMEOFFSET datatype.

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000