07-18-2003, 08:11 AM
MEG,
All the implementatioms that I've seen do one of the following:
1) Ignore the year 1582 problem altogether, just like your code does.
2) Pick a pivot date like 1800 or newer, and figure cumulative days as starting on January 1st of that pivot date.
You are one heck of a programmer for doing that program in 1.5 hours. It would take me more than that just to analyse the problem.
However, I must comment on the one-liner for calculating the number of days in a month. Although it works, I think this piece of code it is excessively complex, almost Machiavellian.
By the way, a published six-line algorithm exists for converting a date to the number of days from year zero. It also is a bit complex.
*****
All the implementatioms that I've seen do one of the following:
1) Ignore the year 1582 problem altogether, just like your code does.
2) Pick a pivot date like 1800 or newer, and figure cumulative days as starting on January 1st of that pivot date.
You are one heck of a programmer for doing that program in 1.5 hours. It would take me more than that just to analyse the problem.
However, I must comment on the one-liner for calculating the number of days in a month. Although it works, I think this piece of code it is excessively complex, almost Machiavellian.
By the way, a published six-line algorithm exists for converting a date to the number of days from year zero. It also is a bit complex.
*****