Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us