Solved

Hot to Convert UTC Time to DATETIME

Posted on 2002-06-23
5
3,123 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

749 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