Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A simpler and easier way to calculate the day of the week for any date is the First Sunday Doomsday algorithm: http://firstsundaydoomsday.blogspot.com/2009/12/quick-start-...

(There’s also a earn-by-example page: http://firstsundaydoomsday.blogspot.com/2011/01/learn-by-exa...)

Using Sundays rather than doomsdays simplifies the arithmetic. Another improvement the above approach incorporates is the odd+11 rule for calculating the year code.



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

Search: