Hacker News new | past | comments | ask | show | jobs | submit login

Judging by that table (month numbers being the same for Feb + March in 2024), you have to adjust -1 for dates before March in leap years?



Yup. The designers of these kind of day of the week systems generally design as if the year started on March 1, so leap year shenanigans just mess with the last day of the year. They take that into account in their formulas for the century-based and year-based terms of the formulas so that each March 1 will be the right number of days after the previous March 1.

That way when using the system you don't have to care about leap years except during January and February. The formulas always give February 28th as the day before March 1 which in leap years is one day too late because of February 29th, and so as you surmised you need to adjust by -1 for dates in those months.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: