Daddymax,
In SQL, you can use: SELECT TIME ('12:10:10') + 3 HOURS FROM SYSIBM.SYSDUMMY1; This gives you 3 hours
from 12 which is 15:10:15 (3 hours past noon).
This also works, if you need to subtract minutes and
seconds, also:
SELECT TIME ('12:10:10') - '05:10:00' FROM sYSIBM.SYSDUMMY1
The IBM OS/390 UDB manuals (under time arithmetic) specify
that you have
to go through some additional steps first, due to the time variables: |
| ? If SECOND(TIME2) <= SECOND(TIME1) |
| then SECOND(RESULT) = SECOND(TIME1) - SECOND(TIME2). |
| |
| ? If SECOND(TIME2) > SECOND(TIME1) |
| then SECOND(RESULT) = 60 + SECOND(TIME1) - SECOND(TIME2) |
| and MINUTE(TIME2) is incremented by 1. |
| ? If MINUTE(TIME2) <= MINUTE(TIME1) |
| then MINUTE(RESULT) = MINUTE(TIME1) - MINUTE(TIME2). |
| ? If MINUTE(TIME2) > MINUTE(TIME1) |
| then MINUTE(RESULT) = 60 + MINUTE(TIME1) - MINUTE(TIME2) |
| and HOUR(TIME2) is incremented by 1. | ? HOUR(RESULT) = HOUR(TIME1) - HOUR(TIME2). |
Last Wiki Answer Submitted: January 18, 2005 3:15 pm by SQLLER0 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.