The Julian / Gregorian Calendar Transition of 1582 ADThe calendar below represents the Julian/Gregorian transition calendar of October 1582, the official end (in Catholic countries and domains) of the old Julian calendar system and the inauguration of the modern Gregorian calendar we use today.
The old Julian calendar officially ended on:
Thursday, October 4^{th}, 1582.  Highlighted in yellow . JD = 2299160 The date following October 4th was the official beginning (in Catholic countries) of the modern Gregorian calendar and that date was: Friday, October 15^{th}, 1582.  Highlighted in cyan . JD = 2299161 The transition year, 1582, was both a Julian and a Gregorian year the first 277 days being on the Julian calendar and the last 78 days being on the Gregorian calendar, for a total of 355 calendar days that year due to the 10 dropped days. Since it was implemented by a Catholic Pope, the Gregorian calendar at first was only binding on catholic countries. It took hundreds of years for the Gregorian calendar to be adopted as the replacement for the old Julian calendar in nonCatholic countries and evolve to become the world standard calendar for international trade and commerce. In the USA, the Gregorian calendar was not adopted until September of 1752. Previously, on the Julian calendar, every four years without exception was a leap year. This was the error that was causing the problem. Leap years were happening too often. The error, although very small, was causing the dates of the start of spring to slowly drift away from March 21st. As a result, after over 1500 years, the error accumulated to such an extent that true astronomical spring was starting on March 11th or some 10 days too early acccording to the Julian calendar. The calendar reform of 1582 had two basic parts:
Starting on January 1st of any Julian leap year: 4 Julian centuries contains exactly: 36525 + 36525 + 36525 + 36525 = 146100 days On the Gregorian calendar, only one out of four century years is a leap year which means that if the first one is a leap year then it is followed by three consecutive century years which are NOT leap years and then the cycle repeats. Only the fist century has the full 36525 days while the other 3 centuries have only 36524 days each because they each have 1 less leap year. Starting on January 1st of any Gregorian leap year: 4 Gregorian centuries contains 36525 + 36524 + 36524 + 36524 = 146097 days Consequently, 4 Gregorian centuries has 3 less days than 4 Julian centuries due to 3 fewer leap years. The Gregorian Correction to the Julian Calendar or the Difference In Days Between Them When the Gregorian calendar was first introduced, 10 days had to be dropped in the transition. Since the British, and hence the Colonies, took so long to adopt the Gregorian calendar, that by the time they finally did, some 170 years later, 11 days, rather than 10, had to be dropped in the transition. In the New England Colonies, the transition took place on Wednesday, September 2nd, 1752. The following date was Thursday, September 14th, 1752. Eleven days were dropped in the transition. As of March 1st, 1800, until February 29th, 2100, we have to drop 13 days from the Julian calendar. Let: y = Calendar Year ( Negative = BC year ) and m = Month (1 to 12)
This algorithm can be used to compute the number of days we have to apply to correct from the Julian to the Gregorian calendar on any day of the given month and year. This value is applied to the Julian JD number of any Julian date to obtain the JD number of the corresponding date on the Gregorian calendar instead, which has a slightly earlier mathematical origin (JD=0) date. This algorithm also applies to proleptic calendar dates.
A negative GregCorr value means we would have to drop that many days from the calendar when switching from Julian to Gregorian. Note that the day (d) of the month is not needed for this computation. EXAMPLE: If we waited until April 15th, 2010 to switch from the Julian to the Gregorian calendar, what would be the calendar date following April 15th? Let: y = 2010, m = 4 and CalMode = 1 Then, applying the above algorithm gives: if (y < 0) then w = y+1 else w = y so w = 2010 and u = floor( (w  floor((14m)/12) ) / 100) = floor( (2010  floor(10/12) ) / 100) = floor( (2010  0 ) / 100) = 20 and GregCorr = floor(u/4)  u + 2 = floor(20/4)  20 + 2 = 5  20 + 2 = 13This means that if we had waited until April 15th, 2010 to switch from the Julian to the Gregorian calendar, then we would have had to have dropped 13 days in the transition, no matter what day in April we chose to be the transition day. In other words, the date following our transition day would have had to have been 13 days later than what it would have been otherwise, in this case, April (16+13) = April 29th, in effect, dropping 13 days from the calendar. In PHP code, the above algorithm could be expressed as $u = floor(((($y < 0)? $y+1 : $y)  floor((14$m)/12)) / 100); $GregCorr = floor($u/4)  $u + 2; Jay Tanner  2016
