+ 8

Birth Day Name for Old People

During the recent birthday frenzy, I wondered if there was an easy Python way to find out what day of the week I was born on. Turns out there is, using the calendar.weekday() method, as long as you weren't born before 1970 (when I was 21). Before that, you have to use weird things like Zeller's Congruence Algorithm. I wrote this bit of code using both. https://code.sololearn.com/cpFL07GwYcx5

24th May 2017, 1:20 AM
David Ashton
David Ashton - avatar
4 Respostas
+ 10
Thanks David, I always wondered was Monday the first day of 1 AD :)
24th May 2017, 5:39 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 7
I didn't know that algorithm but my first program (calculates day if date is given in C++) uses the fact that 01-01-0001 is Monday. I found it by counting backwards from the day I wrote that program.
24th May 2017, 5:57 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 6
I like how you done all the research for this. I did not know about this algorithm. Nice work! I have often wondered how one would calculate days before epoch
24th May 2017, 1:26 AM
jay
jay - avatar
+ 4
I found an easier method than Zeller's formula but requires a little memorisation of values
24th May 2017, 5:42 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar