+ 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
4 odpowiedzi
+ 10
Thanks David, I always wondered was Monday the first day of 1 AD :)
+ 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.
+ 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
+ 4
I found an easier method than Zeller's formula but requires a little memorisation of values