Fair enough. Perhaps I assume too much.
So you should condition to be sure the duration does not go over 23 hours
49 minutes, and you should also be sure when outputing to screen or print,
that the time is using a format other than *USA. Choose your format based
on which separator you need.
And Luis is right, you should use full timestamps on your %Diff parameters
to ensure the duration in seconds calculates properly if the time span
crosses midnight.
Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi
Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
05/24/2010 12:50 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
cc
Subject
Re: Difference between 2 time values expressed in hh:mm:ss format
Hi Brian,
When you give this answer again (and you will -- I've given it at least
twice a month for the past 4 years) please add a disclaimer.
The disclaimer is that the TIME data type was not intended to store a
DURATION. It was meant to identify a particular moment of the day, not
to express an amount of time that has passed.
Consequently, it does not work well for this sort of thing. For
example, if there's 15 hours and 20 minutes have elapsed between a
start/end timestamp, and you format the time in USA format, it'll say
"3:20 PM" It identifies a time of the day, not a number of hours that
elapsed.
Likewise, if you try to exceed 24 hours, you'll get an error. For
example, you can't make it say 26 hrs, 5 minutes. Why not? Because it
identifies a time of day, and there's no 26 O'Clock.
So while the technique you propose does have value in certain
circumstances, you should understand that you're doing something that
wasn't really intended -- and therefore won't always do what you expect.
On 5/24/2010 9:04 AM, BMay@xxxxxxxxx wrote:
Use the %Diff Bif to get the difference in seconds. Then add the
seconds
to a time field set for midnight (00:00:00).
As an Amazon Associate we earn from qualifying purchases.