Modified after: Marc A. Murison Astronomical Applications Dept. U.S. Naval Observatory 3450 Massachusetts Ave, NW Washington, DC 20392-5420"
It is assumed that 7-day weeks have formed an uninterrupted sequence since ancient times. Thus, the day of the week can be obtained from the remainder of the division of the Julian Date by 7.
Calendar dates year, month, and day are more problematic. Various calendar systems have been in use at different times and places around the world. This application deals with only two: the Gregorian calendar, now used universally for civil purposes, and the Julian calendar, its predecessor in the western world. As used here, the two calendars have identical month names and number of days in each month, and differ only in the rule for leap years. The Julian calendar has a leap year every fourth year, while the Gregorian calendar has a leap year every fourth year except century years not exactly divisible by 400.
This application assumes that the changeover from the Julian calendar to the Gregorian calendar occurred in October of 1582, according to the scheme instituted by Pope Gregory XIII. Specifically, for dates on or before 4 October 1582, the Julian calendar is used; for dates on or after 15 October 1582, the Gregorian calendar is used. Thus, there is a ten-day gap in calendar dates, but no discontinuity in Julian Dates or days of the week: 4 October 1582 (Julian) is a Thursday, which begins at JD 2299159.5; and 15 October 1582 (Gregorian) is a Friday, which begins at JD 2299160.5. The omission of ten days of calendar dates was necessitated by the astronomical error built up by the Julian calendar over its many centuries of use, due to its too-frequent leap years.
The changeover to the Gregorian calendar system occurred as described above only in Roman Catholic countries, however. Adoption of the Gregorian calendar in the rest of the world progressed slowly. For example, for England and its colonies, the change did not occur until September 1752. (The Unix cal command for systems manufactured in the U.S. reflects the 1752 changeover.)