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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How to sabe GetDate() in Eastern TimeZone
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

108 Posts

Posted - 06/18/2013 :  17:00:20  Show Profile  Reply with Quote
I have default value in a column as "GetDate()" but the time it saves is the server time on which the database is sitting.

As database is hosted in different time zone, when I see the values, I don't get correct time as I want time to be saved in eastern standard time zone.

any help ?

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 06/18/2013 :  18:04:48  Show Profile  Reply with Quote
Store the time in UTC (using GETUTCDATE() instead of GETDATE()). Then, depending on whether it is daylight savings time or standard time, subtract 4 or five hours. Now it is daylight savings time, so you would do this to get Eastern Daylight Time:
If you have a server that is set up to adjust for the daylight and standard times in eastern time zone , you can convert from UTC to Eastern without having to hardcode 4 or 5 like this:
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