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: 6966
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 CICS transaction slow response time vasanthz All Other Mainframe Topics 1 Thu Jan 19, 2017 1:31 am
No new posts DD DUMMY & CPU TIME Nileshkul Testing & Performance analysis 16 Mon Dec 19, 2016 11:35 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


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