06-13-2003, 08:51 AM
What is the maximum number of weeks that any year can have?
For those of you that have set up tables or arrays for 52 weeks, or more cleverly for 53 weeks --- the answer is 54.
In a leap year which begins on a Saturday, the last day of the year (December 31st) falls on a Sunday and is the first day of the 54th week.
This condition happens every 28 years. It happened in 1972 and 2000, and blew away many a payroll system that worked on weeks.
Now for the quiz.
1) How do you test if a year is a leap year?
2) How do you know the day of the week for any given date?
Please, just respond with tested solutions, and no other bull. This is intended to help others. Have your fun coding and testing, ok.
For those of you that have set up tables or arrays for 52 weeks, or more cleverly for 53 weeks --- the answer is 54.
In a leap year which begins on a Saturday, the last day of the year (December 31st) falls on a Sunday and is the first day of the 54th week.
This condition happens every 28 years. It happened in 1972 and 2000, and blew away many a payroll system that worked on weeks.
Now for the quiz.
1) How do you test if a year is a leap year?
2) How do you know the day of the week for any given date?
Please, just respond with tested solutions, and no other bull. This is intended to help others. Have your fun coding and testing, ok.