Alex Angelopoulos (aka at mvps dot org)
Some rough information for dealing with calendar conversions. Some things you should know to start out.
Calendar conversion is done most easily by getting a normal, decimal notation number for dates in relation to some absolute. The normal baseline used for that in the Western world is a Julian day number, calculated from 12 noon GMT -4712-11-24 (Gregorian Proleptic).
Next, there is a very bad and non-standard habit some people have of referring to the numeric day of a year as a Julian date. This is incorrect and is highly confusing; don't use that term.
Remember that day lengths vary; over time, the length of a day is increasing. Counting days is not an absolute measure of time in the strict sense.
Windows systems use locale-specific time calculations; that means that a file stamped with "3 AM" shows up as 3 AM in any time zone. Unix/Linux systems in general use an internal UTC stamp and render it into the local time. One effect of this is that absolute date measurements on Windows systems are done relative to the present time zone, and any absolute times and dates are assumed to refer to the local time zone. For this reason, it is best to convert anything into a UTC time. A Windows date and time is not complete information about time of an event without accompanying time zone information.
Since calendars usually measure elapsed diurnal cycles, not time (with the exception of some specialty calendars such as the modern Besselian calendar) we can treat their fundamental unit as a day. A counting system based on days then can serve as an excellent simplifying lingua franca for date calculations.
For the European-descended cultures, the Julian Day Number is a good reference with known data points. The following table is a list of important marker dates in this system. The table is derived from Peter Baum's Table 2 on his Calendars and Dates page.
Julian Day | Julian Calendar Date | Gregorian Calendar Date | Comments |
0 | -4712-1-1.5 | -4713-11-24.5 | JD Reference Date |
0.5 | -4712-1-2 | -4713-11-25 | middle of JD reference day (midnight) |
1721059.5 | 0-1-3 | 0-1-1 | The first day of 1 |
1721118.5 | 0-3-2 | 0-2-29 | Rata Die = -306 |
1721119.5 | 0-3-3 | 0-3-1 | Rata Die = -305 |
1721424.5 | 1-1-2 | 0-12-31 | Rata Die = 0 |
1721425.5 | 1-1-3 | 1-1-1 | Rata Die = 1 |
2299159.5 | 1582-10-4 | 1582-10-14 | last day before Gregorian reform |
2299160.5 | 1582-10-5 | 1582-10-15 | first day of Gregorian reform |
2393470.5 | 1840-12-19 | 1840-12-31 | M programming language reference |
2400000.5 | 1858-11-5 | 1858-11-17 | Modified Julian Day 0.0 |
2415018.5 | 1899-12-18 | 1899-12-30 | OLE reference date |
2415385.5 | 1900-12-19 | 1901-1-1 | start of the 20th century |
2440587.5 | 1969-12-19 | 1970-1-1 | Unix reference date |
2444239.5 | 1979-12-19 | 1980-1-1 | PC (DOS) reference date |
Note that in the areas that did the changeover in calendars in October 1582, people flipped from the Julian Calendar to the Gregorian Calendar column at the end of JD 2299160. When they went on bed on the night of JD 2299160 the date was October 4; arising on the morning of JD 2299161, the date was called October 15.