How do i get the current time in a specific timezone using a query in sql server 2005

I have my web servers hosted in the USA. But i need to display the local time in India.  How do i achieve this. Thanks
TECH_NETAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Brad HoweConnect With a Mentor DevOps ManagerCommented:
Hi There,

There is no function for this in SQL 2005 and this is a known issue. Take a look at this table and code to get different timezone stamps.

http://www.codeproject.com/KB/database/SQL2005_TIME_ZONES.aspx

In SQL Server 2008, Microsoft type for datetime called  the datetimeoffset data type.

Cheers,
Hades666
0
 
ralmadaCommented:
I would just use the getutcdate() built-in function to do the job. For example, the below will give you local time in New Delphi, which is UTC + 5:30

select dateadd(min, 30, dateadd(h, 5, getutcdate()))

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.