The first parameter in TIMESTAMPDIFF determines the result. 2=Seconds,
4=Minutes, etc.
For more info, Read The Fine Manual :-)
"Goestenkors James G "
<db2udbdba-ezmlmshield-x82430671.[Email address protected]
03/24/2008 10:21 AM
To
"LazyDBA Discussion" <[Email address protected]
cc
Subject
RE: Timestamp arithmetic
if you are working with a date/time which excludes seconds (yyyy-mm-ss
hh:mm), how would you get an answer in minutes?
-----Original Message-----
From: James Van Sickle
[mailto:db2udbdba-ezmlmshield-x50895452.[Email address protected]
Sent: Thursday, March 13, 2008 9:53 AM
To: LazyDBA Discussion
Subject: RE: Timestamp arithmetic
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
---------------------------------------------------------------------
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
*******************************
The information contained in this message may be privileged and/or
confidential and protected from disclosure. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. Note that any views or opinions presented in this
message are solely those of the author and do not necessarily represent
those of Ameren. All emails are subject to monitoring and archival.
Finally, the recipient should check this message and any attachments for
the presence of viruses. Ameren accepts no liability for any damage caused
by any virus transmitted by this email. If you have received this in
error, please notify the sender immediately by replying to the message and
deleting the material from any computer. Ameren Corporation
*******************************
---------------------------------------------------------------------
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