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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 TimeZone Conversion

Author  Topic 

bhanu2217
Starting Member

35 Posts

Posted - 2010-05-17 : 07:24:45
My application is on a server in US but i live in India, so basically i would like to convert the time into my LocalTime Zone.
All the date&time that i put in Database are in UTC format. Now i want to convert them into UTC+5:30 Indian Standard Time.

Here is my query

SELECT * FROM enp_newspaperpage page join enp_newspaper newsPaper on newsPaper.PaperID =page.PaperID where page.PaperID='1' and CONVERT(VARCHAR, newsPaper.Date, 113) <= CONVERT(VARCHAR, GETDATE(), 102 order by page.PageNo

where newsPaper.Date is in UTC Time Zone, so GETDATE should also be in UTC. So please let me know how i can convert GETDATE into UTC.

I am using SQL Server 2008.


www.JamboreeBliss.com

dattatreysindol
Starting Member

20 Posts

Posted - 2010-05-17 : 07:51:16
Hi There -

From your question, I understand that you want to get the current date (GETDATE) in the UTC timezone.
To get the current UTC time, there is a function in SQL Server as "GETUTCDATE()". In your below query, use GETUTCDATE() instead of GETDATE().

Hope that helps!


Dattatrey Sindol
http://mytechnobook.blogspot.com/

This information is provided "AS IS" with no warranties, and confers no rights.
Go to Top of Page

bhanu2217
Starting Member

35 Posts

Posted - 2010-05-17 : 09:26:04
quote:
Originally posted by dattatreysindol

Hi There -

From your question, I understand that you want to get the current date (GETDATE) in the UTC timezone.
To get the current UTC time, there is a function in SQL Server as "GETUTCDATE()". In your below query, use GETUTCDATE() instead of GETDATE().

Hope that helps!


Dattatrey Sindol
http://mytechnobook.blogspot.com/

This information is provided "AS IS" with no warranties, and confers no rights.



Thank you.

www.JamboreeBliss.com
Go to Top of Page
   

- Advertisement -