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

Timestamp difference in seconds - DB2 version 7


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

New User


Joined: 06 Jul 2006
Posts: 3
Location: Chennai, India

PostPosted: Thu Jul 06, 2006 3:38 pm
Reply with quote

Hi,

I am trying to find out the difference between two timestamps in seconds.
Am not able to use TIMESTAMPDIFF as that works in version 8.
Could anyone suggest an alternative that would work in version 7?

Thanks in advance.
Back to top
View user's profile Send private message
Hanfur

Active User


Joined: 21 Jun 2006
Posts: 104

PostPosted: Fri Jul 07, 2006 10:13 am
Reply with quote

If u use any host language you could capture time using the TIME_STAMP data type like this in seconds.

SELECT INT(HOUR(CURRENT_TIMESTAMP) * 3600) +
INT(MINUTE(CURRENT_TIMESTAMP) * 60) +
INT(SECOND(CURRENT_TIMESTAMP))
INTO :WS-START-SECONDS
FROM SYSIBM.SYSDUMMY1

This is used in host language u may need to tweak this to get the differnec in time stamp value from table.

-Han.
Back to top
View user's profile Send private message
mrajagop

New User


Joined: 06 Jul 2006
Posts: 3
Location: Chennai, India

PostPosted: Fri Jul 07, 2006 10:45 am
Reply with quote

Thank you, Hanfur.

In this case, the date part of the timestamp also needs to be converted to seconds. Of course we could use functions like YEAR(), MONTH() and DAY() to find that out.

If there is some other way out, could you please let me know?

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

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 11
No new posts Convert Service Unit to CPU Seconds All Other Mainframe Topics 1
No new posts Difference between joblib and steplib JCL & VSAM 2
No new posts Pull data using date difference betwe... DB2 6
No new posts Difference between PLT txn and schedu... CICS 3
Search our Forums:


Back to Top