## determine time of day from elapsed time

pts.
Tags:
Development
does anyone know of a routine that would allow me to determine the time of day based on a beginning time and a elapsed time in hh:mm:ss?
Related Questions

## Answer Wiki

Thanks. We'll let you know when a new response is added.

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). |

## Discuss This Question:

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.