an inspiring solution to the not-so-inspired calendar

calendar comic Pope Gregory XIII may have meant well when he introduced his calendar to the Western world but unfortunately the "new and improved calendar" still falls short in a number of ways. It made some improvements on the Julian calendar but still gave us this funny business of fluctuating days in a month. The awkward situation of how many days go in a month hasn't slowed Google down though. They have marched forward and created a very clever system to determine dates. Google calendar can determine a date by a single number.

For example 23131 represents the date February 27, 2015. Some very clever math using modular arithmetic (which may seem hard but which computer do quite easily) allows us to derive a precise date. Stack Overflow's @Fuhrmanator gives a description of how this works:

Divide by 512 and add 1970 (epoch) for the year.

23131 / 512 = 45.xxx => 45 + 1970 = 2015.  

Get the remainder of that division and divide by 32 to find the month.

23131 mod 512 = 91 / 32 = 2.xxx = February  

Get the remainder of that division and it's the day.

91 mod 32 = 27  

Now if Pope Gregory had spent maybe a little more time he could have possibly arrived at a much more elegant and intuitive calendar but if he would have, we would not have gone through such a rewarding math exercise.

comments powered by Disqus