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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
Search our Forums:

Back to Top