Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to get difference of timestamp in HH:MM:SS format
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    Post subject: Re: How to get difference of timestamp in HH:MM:SS format
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us