Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 04, 2012 10:54 AM by Chen Yu - MSFT
Participant
1702 Points
897 Posts
Apr 30, 2012 02:54 PM|LINK
I have a small database (57MB) in SQL Server 2008. The SQL server and the web server are located in the eastern time zone.
I want it to do functions etc, like getdate(), using CST.
Is it simpliest to just change all getDate() functions to DATEADD(hour, - 1, GETDATE())?
I have about 6 places I would have to take this into account.
Thanks
Contributor
2356 Points
478 Posts
Apr 30, 2012 03:12 PM|LINK
Did you see this http://msdn.microsoft.com/en-us/library/ms973825.aspx
2212 Points
401 Posts
Apr 30, 2012 03:21 PM|LINK
H!
The query for this should be like:
DECLARE @CSTTime as DateTime SET @CSTime = '2012-04-30 18:51:55.293' SELECT DATEADD(HOUR, -1, @CSTTime) as ESTTime
You can use GetDate() also.
Hope this will help you.
Regards.
All-Star
21600 Points
2493 Posts
Microsoft
May 04, 2012 10:54 AM|LINK
craigbtx I have a small database (57MB) in SQL Server 2008. The SQL server and the web server are located in the eastern time zone. I want it to do functions etc, like getdate(), using CST. Is it simpliest to just change all getDate() functions to DATEADD(hour, - 1, GETDATE())? I have about 6 places I would have to take this into account. Thanks
Hi,
Yes, you could use DATEADD() in your query if you know the time difference between eastern and CST.
DateAdd: http://msdn.microsoft.com/en-us/library/ms186819.aspx
Thanks.
craigbtx
Participant
1702 Points
897 Posts
Time Zone and getDate()
Apr 30, 2012 02:54 PM|LINK
I have a small database (57MB) in SQL Server 2008. The SQL server and the web server are located in the eastern time zone.
I want it to do functions etc, like getdate(), using CST.
Is it simpliest to just change all getDate() functions to DATEADD(hour, - 1, GETDATE())?
I have about 6 places I would have to take this into account.
Thanks
Bimalvv
Contributor
2356 Points
478 Posts
Re: Time Zone and getDate()
Apr 30, 2012 03:12 PM|LINK
Did you see this http://msdn.microsoft.com/en-us/library/ms973825.aspx
Bimal
AccuWebHosti...
Contributor
2212 Points
401 Posts
Re: Time Zone and getDate()
Apr 30, 2012 03:21 PM|LINK
H!
The query for this should be like:
You can use GetDate() also.
Hope this will help you.
Regards.
Top Windows VPS Provider
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: Time Zone and getDate()
May 04, 2012 10:54 AM|LINK
Hi,
Yes, you could use DATEADD() in your query if you know the time difference between eastern and CST.
DateAdd: http://msdn.microsoft.com/en-us/library/ms186819.aspx
Thanks.
Feedback to us
Develop and promote your apps in Windows Store