IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to get the difference of timestamps in DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkata.bellala

New User


Joined: 11 Mar 2005
Posts: 4

PostPosted: Tue May 17, 2005 12:00 pm
Reply with quote

Hi,
How to get the difference of timestamps in DB2

regards,
Venkata Bellala
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Tue May 17, 2005 1:06 pm
Reply with quote

Hi Venkata,

You can use - (Minus) between two Time stamps to find out the difference. The result will be in the form of seconds. If you want to convert it into days,months or years we can use some calculation.

Eg: select CRTTMSTP,current timestamp,current timestamp-CRTTMSTP
from user.table;
(It returns the difference between current time stamp and create time stamp in seconds)

select CRTTMSTP,current timestamp,(current timestamp-CRTTMSTP)/(60*60*24) from user.table;
(It returns the difference between current time stamp and create time stamp in days)

Thanks,
Reddy.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
Search our Forums:

Back to Top