|laziness, impatience, and hubris|
Re: Simple calendarby chuckbutler (Prior)
|on Mar 08, 2010 at 03:28 UTC||Need Help??|
The calendar thing is one those functions that you do use from day to day. Most of the time I have used Calendar::Calendar to generate a straight grid type, but you mentioned that this may no work for you.
There are formulas to calculate month length, but the easiest is to set up a table, zero relative of the month length. Thirty days as November, April, June, and September, the others, save February, have thirty-one. February....
In February a little math is necessary. It is a leap year, 29 day, if:
So, right to left, years that are divisible by 400 are leap years, years divisible by 100, but not 400, are not, other years, save those divisible by 100 before, that are divisible by 4 are, and what is left is not.
I hope was able to give you some timely information.
Good luck. -c
Updated to fix a typo... -c