Try this, Ed:
select timestampdiff(2, cast(timestamp('2008-03-13 09:06:00') -
timestamp('2008-03-13 09:05:00') as char(22)))
as difference_in_seconds
from sysibm.sysdummy1
Result = 60
Jim
"Edwards Ed " <db2udbdba-ezmlmshield-x34709752.[Email address protected]
03/13/2008 10:24 AM
To
"LazyDBA Discussion" <[Email address protected]
cc
Subject
RE: Timestamp arithmetic
Well, well, well!
It's Das Ashim K! hehe. How have you been?
select (minute('2008-03-13 09:07:00') - minute( '2008-03-13 09:05:00'))
* 60 as difference_in_seconds
from sysibm.sysdummy1
Please take a few minutes to provide feedback on the quality of service
you received from our staff. The Department of Education values your
feedback as a customer. Commissioner of Education Dr. Eric J. Smith is
committed to continuously assessing and improving the level and quality of
services provided to you.Simply use the link below. Thank you in advance
for completing the survey.
http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]
-----Original Message-----
From: Das Ashim K
[mailto:db2udbdba-ezmlmshield-x91339140.[Email address protected]
Sent: Thursday, March 13, 2008 9:36 AM
To: LazyDBA Discussion
Subject: Timestamp arithmetic
Hi,
What is the best way to get the time difference in seconds in DB2
For eg, the query below
select ( timestamp_format( '2008-03-13 09:06:00', 'yyyy-mm-dd
hh24:mi:ss' )-
timestamp_format( '2008-03-13 09:05:00', 'yyyy-mm-dd
hh24:mi:ss'
)
)
From sysibm.sysdummy1
Returns:
100
How do I convert this into seconds?
Thanks,
Ashim.
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
DB2 & UDB email list listserv db2-l LazyDBA home page