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
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Unloading DB2 table in CSV format alo... grvtomar COBOL Programming 7 Sun Jan 28, 2018 2:05 am
This topic is locked: you cannot edit posts or make replies. UTC Timestamp Log Thangavel COBOL Programming 5 Mon Jan 22, 2018 9:04 pm
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm

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