Solved

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

Posted on 2010-08-21
2
319 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:TECH_NET
2 Comments
 
LVL 30

Accepted Solution

by:
Brad Howe earned 500 total points
ID: 33493828
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
 
LVL 41

Expert Comment

by:ralmada
ID: 33501627
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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now