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

How to get difference of timestamp in HH:MM:SS format


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

New User


Joined: 13 Feb 2007
Posts: 5
Location: Bangalore

PostPosted: Wed Jun 13, 2007 9:00 pm
Reply with quote

Hi,

I would like to know how to get difference of timestamp in HH:MM:SS format in a SQL query.

Consider 2 timestamp columns in a table
PROG_START_TS and PROG_ENDE_TS.
I would like to select difference between these timestamps in a readable format.

Thanks
Vivek.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Jun 13, 2007 10:36 pm
Reply with quote

vijigobi wrote:
Hi,

I would like to know how to get difference of timestamp in HH:MM:SS format in a SQL query.

Consider 2 timestamp columns in a table
PROG_START_TS and PROG_ENDE_TS.
I would like to select difference between these timestamps in a readable format.

Thanks
Vivek.


DB2 will return the difference of two times as a decimal(6,0) value , hhmmss.
time(prog_ende_ts) - time(prog_start_ts)

For timestamps the difference is a decimal(26,6) value, yyyymmddhhmmss.sssss

prog_ende_ts - prog_start_ts

If you use just the time of the timestamp you may will end up with an incorrect answer if the dates are different.
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
Search our Forums:

Back to Top