Julian dates (abbreviated JD) are simply a continuous count of days and fractions since noon Universal Time on January 1, 4713 BCE (on the Julian calendar).
Almost 2.5 million days have transpired since this date. Julian dates are widely used as time variables within astronomical software.
Typically, a 64-bit floating point (double precision) variable can represent an epoch expressed as a Julian date to about 1 millisecond precision.
Note that the time scale that is the basis for Julian dates is Universal Time, and that 0h UT corresponds to a Julian date fraction of 0.5.
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.)