Question

  Asked: Apr 21 2008   6:42 PM GMT
  Asked by: Apinto


Convert time to GMT time


getDate(), convert, SQL, T/SQL, GMT

In t-sql, I want to store the date from the getDate() function in GMT time instead of local time.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0



You will want to use the getutcdate() function instead of the getdate() function. This will return the UTC date instead of the local date.

There is no way to tell existing columns to convert to UTC time when saving the data.

SQL 2008 will include the DATETIMEOFFSET data type which will allow you to store the timezone information of the value along with the data type. You can read more here
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and SQL Server.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Mrdenny  |   Apr 21 2008  7:09PM GMT

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.