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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need some help wiht :CAST AS Double 11 46
Isolation level in SQL server 3 50
create insert script based on records in a table 4 21
Sql Server group by 10 27
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

772 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