Converting data and time to timestamp

Database

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
1 REPLY
Teradata Employee

Re: Converting data and time to timestamp

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