All Forums Database
goldminer 118 posts Joined 05/09
31 Mar 2010
Converting data and time to timestamp

When I run the following, the date portion of the timestamp is always the previous day.

SELECT CAST(CURRENT_DATE AS TIMESTAMP(0)) + ((CURRENT_TIME - TIME '00:00:00') HOUR TO SECOND(0));

Anybody know why this is occuring?

DateTime format set to AAA in ODBC

DATEFORM SET TO ANSIDATE

Adeel Chaudhry 773 posts Joined 04/08
01 Apr 2010

Hi,

The format of the date/time don't usually change the date/time value .... please verify if your server's date is different than your client's date.

Following query may be used to verify the results:

SELECT CAST(CURRENT_DATE AS TIMESTAMP(0)) + ((CURRENT_TIME - TIME '00:00:00') HOUR TO SECOND(0)), CURRENT_TIMESTAMP;

Regards,

MAC

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.