Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrive time in local time not UTC

Status
Not open for further replies.

rookiesql

Technical User
Jul 10, 2003
14
0
0
SE
I am retreiving data from a MS SQL 2000 DB to my EXCEL spreadsheet and this goes well using a SQL query from inside EXCEL. However, I have discovered that the returned data for timestamps is in UTC format while my time zone is CET. I scanned the web for info and found that there is an expression like SELECT ....AT TIME ZONE ...
However, I couldn't get that to work in my SQL query. In my query I want to retrieve a column T1.received_date in local time format.
Has anybody been doing these conversions from UTC and knows how the SQL statement should be written?
Regards
Anders
 
What RDBMS are you using?

In some systems a timestamp is not a date and time, merely an arbitrary number.

This forum is theoetically for questions regarding standard SQl or SQL Standards, I'm not sure which. You may want to post your question in a forum specific to your database.
 
The ANSI/ISO function is called LOCALTIMESTAMP. I don't know if MS SQL supports it.

An optional value can be used to specify the seconds precision for the returned value, like LOCALTIMESTAMP(4).
 
Thanks JarlH.

From Books Online MSSQL Server 7

timestamp
Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table, the timestamp is updated with the current database timestamp value obtained from the @@DBTS function. timestamp data is not related to the date and time of an insert or change to data. To automatically record times that data modifications take place in a table, use either a datetime or smalldatetime data type to record the events and triggers.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top