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
322 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query 2 63
Compare data between two databases 16 111
Sql Data via Excel--performance issues 2 56
Help with simplifying SQL 6 54
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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