Solved

Hot to Convert UTC Time to DATETIME

Posted on 2002-06-23
5
3,120 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

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

932 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

14 Experts available now in Live!

Get 1:1 Help Now