×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
this all makes perfect sense to me, but what I don't get is why the %time
built-in returns 240000 if such a time doesn't even exist according to
common sense.
Bad IBM?
Peter Colpaert
Application Developer
PLI - IT - Kontich, Belgium
-----
Yoda of Borg are we. Futile is resistance, assimilated will you be.
-----
"Larry Ducie" <Larry_Ducie@xxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
28/11/2007 12:05
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
<rpg400-l@xxxxxxxxxxxx>
cc
Subject
RE: 00:00:00 or 24:00:00
Hi Peter,
<snip>
First of all, I'd like to know whether January 1, 2000 00:00:00 is the
same as January 1, 2000 24:00:00 (I would think that the latter actually
means January 2).
Second, which one is correct?
</snip>
There are three different answers to this question:
1) Using standards agreed for formulating the appropriate representation
of
a designated time.
In this case ISO 8601 is your guide and would suggest that they are the
same. Both are correct.
2) Common sense.
I would argue that common sense would dictate that January 1, 2000
24:00:00
should be represented as January 2, 2000 00:00:00., and the latter is
correct.
3) Number theory.
The 24-hour clock is a base-24, base-60, base-60 number system. As such
you
can never have a number 24:00:00 in it.
The time of day is calculated using the complex number system of base-24,
base-60, base-60 for HMS (ignoring decimal fractions of a second which are
base-10 down to infinitely small numbers). At 23:59:59 adding another
second
triggers the standard addition rules to apply, only the bases used differ.
Thus, the seconds column overflows and is set to 00. The full minute now
created is carried over to the minutes column. This makes the minute
column
overflow and is set to 00. The full hour now created is carried to the
hours
column. Again, we have to carry over because the hours column is now full.
Thus we set the hours column to 00 and add 1 to the DAYS column (where did
that come from???). Unless it is the 30th, or 31st, or 28th/29th of a
particular month. If it is December we have years to increment!!! :-)
So, I'd say 24:00:00 is NOT 00:00:00, and 00:00:00 is correct, but what I
say doesn't mattert. Only mathematicians, philosophers and programmers
actually care, but each for very different reasons.
Cheers
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.