Please start any new threads on our new site at http://forums.sqlteam.com. 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
 
Register Now and get your question answered!
Username:
Password:
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  

Apples
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))

SwePeso
Patron Saint of Lost Yaks

Sweden
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.03 seconds. Powered By: Snitz Forums 2000