Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Was the year 1000 (and others) a leap year?

Year Y is a leap year if Y is perfectly divisible by 4, and

  • not by 100, or
  • by 100 and 400

The following sources follow the rule above:

  • Python (output of calendar.monthrange(1000,2) is (5, 28))
  • webconversiononline.com

However, the following sources say 1000 was a leap year:

  • Linux cal (command cal 2 1000 displays 29 days)
  • timeanddate.com

The Gregorian system was introduced in 1582, where the rule above apparently started to apply (before 1582, the only requirement was perfect division by 4). However, testing several other year values (100, 500, 600, 700, 900, 1100, 1300, 1400, 1500 and 1700) indicate that only after and including 1800 the results of Python and Linux cal agree.

Why do these sources give different answers?

like image 395
aslan Avatar asked Jan 25 '17 11:01

aslan


1 Answers

The calendar module uses the proleptic Gregorian calendar.

From the calendar docs:

Most of these functions and classes rely on the datetime module which uses an idealized calendar, the current Gregorian calendar extended in both directions. This matches the definition of the “proleptic Gregorian” calendar in Dershowitz and Reingold’s book “Calendrical Calculations”, where it’s the base calendar for all computations.

From Wikipedia:

The proleptic Gregorian calendar is produced by extending the Gregorian calendar backward to dates preceding its official introduction in 1582.

The Julian calendar was not replaced by the Gregorian calendar on a single date. It was adopted by various countries at different times.

From the Linux cal man page on my (rather ancient) machine:

-s -file ... -country_code

Assume the switch from Julian to Gregorian Calendar at the date associated with the country_code If not specified, ncal tries to guess the switch date from the local environment or falls back to September 2, 1752. This was when Great Britain and her colonies switched to the Gregorian Calendar.

[...]

BUGS

The assignment of Julian–Gregorian switching dates to country codes is historically naive for many countries.

like image 113
PM 2Ring Avatar answered Oct 04 '22 04:10

PM 2Ring