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

Find date and time difference in DB2


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

New User


Joined: 24 Apr 2006
Posts: 4

PostPosted: Mon Sep 10, 2007 8:40 pm
Reply with quote

hi,
can any one plz help me. I have a request date and time , and response date and time. i need to find their difference in minutes in Db2 .. how shud i do it?
for ex- request date 5/08/07
request time 10:30:00

response date 6/08/07
response time 10:28:00
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Sep 10, 2007 9:30 pm
Reply with quote

deepak4wd wrote:
hi,
can any one plz help me. I have a request date and time , and response date and time. i need to find their difference in minutes in Db2 .. how shud i do it?
for ex- request date 5/08/07
request time 10:30:00

response date 6/08/07
response time 10:28:00


You would have get the days and hours difference and after multiplication add in the minutes difference. Look in the sql manual under functions and date-time computations.
Back to top
View user's profile Send private message
deepak4wd

New User


Joined: 24 Apr 2006
Posts: 4

PostPosted: Tue Sep 11, 2007 10:34 am
Reply with quote

Thanx a lot !!!
Back to top
View user's profile Send private message
gagandeep

New User


Joined: 22 Jul 2008
Posts: 3
Location: India

PostPosted: Sat Nov 29, 2008 1:08 pm
Reply with quote

this query would work i suppose..

SELECT timestampdiff (4, char(
timestamp('2007-08-06-10.30.00')-
timestamp('2007-08-07-10.28.00'))) FROM sysibm.sysdummy1

the numeric 4 is to calculate the minutes difference.
To get hours or days 8 and 16 can be used.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top