An old but interesting blog post I ran across not too long ago that
discusses the history of the bug.
http://www.joelonsoftware.com/items/2006/06/16.html
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Monday, December 09, 2013 8:31 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: SQL UDF problem
On Mon, Dec 9, 2013 at 7:44 AM, CRPence <CRPbottle@xxxxxxxxx> wrote:
And then I am left wondering how the "+2" fits in with the "# of
days since 01/01/1900". Seems something is amiss, given the input
value of
19000101 would return two versus zero.? I suppose if the intention
was to represent the number of days since 31-Dec-1899 inclusive of the
date offered as input, then adding two to the difference makes sense.
But what about numeric values representing dates from before that
apparent start date; almost seems the test for greater-than zero maybe
should be greater than 19000100.?
The early design of dates in Excel borrows heavily from Lotus 1-2-3, and
Lotus has a flaw, due either to ignorance, carelessness, or deliberate
risk calculation that users will not need dates before 1900-03-01.
Yes, I said March 1, 1900.
You see, the original date calculation considers 1900-02-29 a valid
date. I.e., it incorrectly considers 1900 a leap year.
It numbers the days starting with 1900-01-01 as 1, 1900-01-02 as 2, etc.
until 1900-02-28 as 59, then 1900-02-29 as 60, 1900-03-01 as 61, and
then consistently adds one from there.
Peter's solution matches Excel for 1900-03-01 and later.
John
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550
As an Amazon Associate we earn from qualifying purchases.