Solved

Hot to Convert UTC Time to DATETIME

Posted on 2002-06-23
5
3,121 Views
Last Modified: 2010-08-05
Hi,

How to convert UTC stored in the database to DateTime
in SQL 2000.

Waiting your answers

Ramesh
0
Comment
Question by:ramesh_khade
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7102282
Please maintain your open questions:
AVoid Entry of URL in Address Bar of Internet Explorer Date: 02/19/2001 05:50AM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20080012
Want to display Rich Text ( Created by Microsoft Word ) on the web pages Date: 05/20/2002 04:00AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20302491
How to display & manipulate ****  Menu ***** Date: 01/30/2001 01:08AM PST  

Thanks,
Anthony






0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7102283
0
 
LVL 35

Accepted Solution

by:
David Todd earned 100 total points
ID: 7125539
Hi,

How have you stored the UTC DateTime?

Have you seen the GetUTCDate() function? It returns a datetime.

In that instance it is a matter of changing the UTC date using DateAdd function

For example ...

declare @UTCDiff     integer
declare @UTCStart     datetime
declare @LocalStart     datetime

declare @Local          datetime
declare @UTC          datetime

select @UTCStart = GetUTCDate(), @LocalStart = Getdate()

select @UTCDiff = -datediff( hour, @UTCStart, @LocalStart )

select @UTC = GetUTCDate(), @Local = getDate()

select @UTC, dateadd( hour, @UTCDiff, @Local ), @Local

There are no doubt better ways to figure out the time zone, but from TSQL I figure this is the quickest ...

Regards
  David
0
 

Expert Comment

by:CleanupPing
ID: 9280265
ramesh_khade:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

770 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