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
 
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: 6970
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 How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need to identify top 10 costly or tim... ashek15 DB2 4 Wed Feb 14, 2018 3:20 am
No new posts Logic to skip Maximum time-stamp and ... vickey_dw DB2 2 Thu Feb 01, 2018 11:15 pm
No new posts Query to skip Max time-stamp and fetc... vickey_dw DB2 8 Sun Jan 28, 2018 1:09 am

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