View previous topic :: View next topic
|
Author |
Message |
latheef
New User
Joined: 25 Sep 2009 Posts: 13 Location: chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
depending on your version of DB2, look in the DB2 Reference and search for DATETIME arithmetic. |
|
Back to top |
|
|
yuvrajdutta
New User
Joined: 13 Jul 2009 Posts: 40 Location: India
|
|
|
|
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 |
|
|
|