06-13-2005, 08:52 AM
Deleter,
I ran the same test as before, and it works fine now. Congratulations.
However, your code for the "maxday" function looks a little shakey, and I suspect it would not work for any dates.The second if "if month=2 and ...." does not have the test for mod 400. I'm not sure it needs it, but it's worth taking a look at it.
The third if "if (((month=2 and year ..." does not say "and month=2" for the mod 100 test. Again, I'm not sure it needs it, but take a look.
EDIT: Somehow I got the wrong impression from looking at your code 'cause it looks different. However, I just tested it again using birthdays from the year 1 to the year 2501 with a current date of 12/31/2501, and it works fine. Sorry for under-estimating your code. Good job!
BTW, I also ran Neo's version with the same dates, and his runs fine also.
*****
I ran the same test as before, and it works fine now. Congratulations.
However, your code for the "maxday" function looks a little shakey, and I suspect it would not work for any dates.
Code:
function maxday(month as integer, year as integer)
tmaxday = 30
if (month/2 <> int(month/2) and month < 8) or (month>7 and month/2 = int(month/2)) then tmaxday=31
if month=2 and ((year mod 4 <> 0) or (year mod 100 = 0)) then tmaxday=28
if (((month=2 and year mod 4 = 0) and year mod 100 <> 0) or (year mod 400 = 0 and month=2))=-1 then tmaxday = 29
maxday=tmaxday
end function
The third if "if (((month=2 and year ..." does not say "and month=2" for the mod 100 test. Again, I'm not sure it needs it, but take a look.
EDIT: Somehow I got the wrong impression from looking at your code 'cause it looks different. However, I just tested it again using birthdays from the year 1 to the year 2501 with a current date of 12/31/2501, and it works fine. Sorry for under-estimating your code. Good job!
BTW, I also ran Neo's version with the same dates, and his runs fine also.
*****