3 ms·
This ever-so-slightly simplifies the calculations. The pattern of dates has a period of 400 years. Your first day of year calculation can ignore the year divisi
by buckminster 7y ago
This ever-so-slightly simplifies the calculations. The pattern of dates has a period of 400 years. Your first day of year calculation can ignore the year divisible by 400 leap year rule if you start in the year after.
- dmurray 7y agoIf you never need to represent dates after 2001, sure.
- mark-r 7y agoThe "divisible by 400" rule means that 2000 wasn't a special case, in the way that 1900 and 2100 are.
- buckminster 7y agoThe calculation for 1/1/2001 is the same as the calculation for 1/1/1601 plus the number of days in 400 years. So it doesn't have to take into account the special case of February 2000. (Other than in the number of days in 400 years, but that's a constant.) I've written the code. It's a tiny bit simpler.