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
 

 

Subtract 4 hours from TIME STAMP

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
latheef

New User


Joined: 25 Sep 2009
Posts: 13
Location: chennai

PostPosted: Fri Aug 05, 2011 3:03 pm    Post subject: Subtract 4 hours from TIME STAMP
Reply with quote

Hi,

I am retrieving TIME STAMP from DB2 Table in COBOL program. My requirement is I need to subtract exactly 4 hours from the retrieved value from DB2 Table. Is there any time routine to calculate this OR any other way to resolve this. Thanks in Advance.

Thanks,
Latheef
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Aug 05, 2011 3:10 pm    Post subject:
Reply with quote

depending on your version of DB2, look in the DB2 Reference and search for DATETIME arithmetic.
Back to top
View user's profile Send private message
yuvrajdutta

New User


Joined: 13 Jul 2009
Posts: 40
Location: India

PostPosted: Fri Aug 05, 2011 6:58 pm    Post subject: Reply to: Subtract 4 hours from TIME STAMP
Reply with quote

Rather than having COBOL do the DATE-TIME arithmetic why don't you let DB2 do the DATE-TIME arithmetic for you..

Code:

SELECT CURRENT TIMESTAMP AS TIME_NOW, CURRENT TIMESTAMP - 4 HOUR AS TIME_NOW_MINUS_4_HOURS FROM SYSIBM.SYSDUMMY1


Code:

TIME_NOW   TIME_NOW_MINUS_4_HOURS
2011-08-05 15:24:32   2011-08-05 11:24:32
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 DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 5 Sat May 06, 2017 12:59 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts Application not run by time HH:MM tri... jzhardy IBM Tools 1 Sun Apr 09, 2017 3:22 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm


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