▲ | habibur 5 days ago | |||||||
> or my favorite January 1, 1600 since 1600 is a multiple of 400 You need to deal with 1600 and 2000 being leap year. While 1700, 1800, 1900 not being a leap year. I limit dates from 1900 to 2100. All !year%4 = leap year. Especially when you try to convert int_date to y,m,d things get tricky. | ||||||||
▲ | kccqzy 4 days ago | parent | next [-] | |||||||
That's exactly why I propose a multiple of 400, not a multiple of 100. The proleptic Gregorian cycle is a 400-year cycle. There are 97 leap years in it. What's tricky about it? Just take a look at my code: https://github.com/kccqzy/smartcal/blob/9cfddf7e85c2c65aa6de... | ||||||||
| ||||||||
▲ | jerf 5 days ago | parent | prev [-] | |||||||
"Years are not leap years, unless % 4, unless % 100, unless % 400." It's a wacky rule for sure. 2000 was fun. Everyone knows about "unless % 4", but there was also an interesting and very vocal set of people who knew about the "unless % 100" but somehow knew that without knowing about the "unless % 400" part. A very specific level of knowledge. |