View previous topic :: View next topic
|
Author |
Message |
mrajagop
New User
Joined: 06 Jul 2006 Posts: 3 Location: Chennai, India
|
|
|
|
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 |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
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 |
|
|
mrajagop
New User
Joined: 06 Jul 2006 Posts: 3 Location: Chennai, India
|
|
|
|
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 |
|
|
|