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!

Truncating Timestamp 1

Status
Not open for further replies.

Jony77

IS-IT--Management
May 4, 2008
9
LU
Hello,
I am new to DB2 and wanted to truncate a time like '2008-08-10 15:04:08' so that I will get a result like '2008-08-10 00:00:00'. What I want to do is to get the beginning of each day.

I tried the following query but always get an error:
Code:
 SELECT TRUNC_TIMESTAMP(CURRENT TIMESTAMP - 24 HOURS,'DDD')
           FROM  SYSIBM.SYSDUMMY1;
Please any idea on how to realize it.

Thanks,

Jony
 
SELECT TIMESTAMP( DATE( AnyTimeStamp ), TIME( '00:00:00' ) ) from ...
 
From the SQL Cookbooks:

function:
DATE

Timestamp and date input have the date part extracted.

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top