Solved

Hot to Convert UTC Time to DATETIME

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

628 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