Welcome to Fourmilab's = calendar=20 converter! This page allows you to interconvert dates in a variety of = calendars,=20 both civil and computer-related. All calculations are done in JavaScript = executed in your own browser; complete source code is embedded in or = linked to=20 this page, and you're free to download<= /A> these=20 files to your own computer and use them even when not connected to the = Internet.=20 To use the page, your browser must support JavaScript and you must not = have=20 disabled execution of that language. Let's see=85=20

The Gregorian calendar is a minor correction to the Julian. In the =
Julian=20
calendar every fourth year is a leap year in which February has 29, not =
28 days,=20
but in the Gregorian, years divisible by 100 are *not* leap years =
unless=20
they are also divisible by 400. How prescient was Pope Gregory! Whatever =
the=20
problems of Y2K, they won't include sloppy programming which assumes =
every year=20
divisible by 4 is a leap year since 2000, unlike the previous and =
subsequent=20
years divisible by 100, *is* a leap year. As in the Julian =
calendar, days=20
are considered to begin at midnight.

The average length of a year in the Gregorian calendar is 365.2425 = days=20 compared to the actual solar tropical year (time from equinox to = equinox) of=20 365.24219878 days, so the calendar accumulates one day of error with = respect to=20 the solar year about every 3300 years. As a purely solar calendar, no = attempt is=20 made to synchronise the start of months to the phases of the Moon.

While one can't properly speak of =93Gregorian dates=94 prior to the = adoption of=20 the calendar in 1582, the calendar can be extrapolated to prior dates. = In doing=20 so, this implementation uses the convention that the year prior to year = 1 is=20 year 0. This differs from the Julian calendar in which there is no year = 0=97the=20 year before year 1 in the Julian calendar is year −1. The date = December 30th, 0=20 in the Gregorian calendar corresponds to January 1st, 1 in the Julian = calendar.=20

A slight modification of the Gregorian calendar would make it even =
more=20
precise. If you add the additional rule that years evenly divisible by =
4000 are=20
*not* leap years, you obtain an average solar year of 365.24225 =
days per=20
year which, compared to the actual mean year of 365.24219878, is =
equivalent to=20
an error of one day over a period of about 19,500 years; this is =
comparable to=20
errors due to tidal braking of the rotation of the Earth.

Astronomers, unlike historians, frequently need to do arithmetic with =
dates.=20
For example: a double star goes into eclipse every 1583.6 days and its =
last=20
mid-eclipse was measured to be on October 17, 2003 at 21:17 UTC. When is =
the=20
next? Well, you could get out your calendar and count days, but it's far =
easier=20
to convert all the quantities in question to Julian day numbers and =
simply add=20
or subtract. Julian days simply enumerate the days and fraction which =
have=20
elapsed since the start of the *Julian era*, which is defined as=20
beginning at noon on Monday, 1st January of year 4713 B.C.E. in the Julian calendar. This date is defined =
in terms=20
of a cycle of years, but has the additional advantage that all known =
historical=20
astronomical observations bear positive Julian day numbers, and periods =
can be=20
determined and events extrapolated by simple addition and subtraction. =
Julian=20
dates are a tad eccentric in starting at noon, but then so are =
astronomers (and=20
systems programmers!)=97when you've become accustomed to rising after =
the =93crack=20
of noon=94 and doing most of your work when the Sun is down, you =
appreciate=20
recording your results in a calendar where the date doesn't change in =
the middle=20
of your workday. But even the Julian day convention bears witness to the =
eurocentrism of 19th century astronomy=97noon at Greenwich is midnight =
on the=20
other side of the world. But the Julian day notation is so deeply =
embedded in=20
astronomy that it is unlikely to be displaced at any time in the =
foreseeable=20
future. It is an ideal system for storing dates in computer programs, =
free of=20
cultural bias and discontinuities at various dates, and can be readily=20
transformed into other calendar systems, as the source code for this =
page=20
illustrates. Use Julian days and fractions (stored in 64 bit or longer =
floating=20
point numbers) in your programs, and be ready for Y10K, Y100K, and Y1MM! =

While any event in recorded human history can be written as a =
positive Julian=20
day number, when working with contemporary events all those digits can =
be=20
cumbersome. A *Modified Julian Day* (MJD) is created by =
subtracting=20
2400000.5 from a Julian day number, and thus represents the number of =
days=20
elapsed since midnight (00:00) Universal Time on November 17, 1858. =
Modified=20
Julian Days are widely used to specify the epoch in tables of orbital =
elements=20
of artificial Earth satellites. Since no such objects existed prior to =
October=20
4, 1957, all satellite-related MJDs are positive.

The Julian calendar was proclaimed by Julius C=E6sar in 46 B.C. and underwent several modifications before = reaching its=20 final form in 8 C.E. The Julian calendar = differs from=20 the Gregorian only in the determination of leap years, lacking the = correction=20 for years divisible by 100 and 400 in the Gregorian calendar. In the = Julian=20 calendar, any positive year is a leap year if divisible by 4. (Negative = years=20 are leap years if the absolute value divided by 4 yields a remainder of = 1.) Days=20 are considered to begin at midnight.

In the Julian calendar the average year has a length of 365.25 days. =
compared=20
to the actual solar tropical year of 365.24219878 days. The calendar =
thus=20
accumulates one day of error with respect to the solar year every 128 =
years.=20
Being a purely solar calendar, no attempt is made to synchronise the =
start of=20
months to the phases of the Moon.

The Hebrew (or Jewish) calendar attempts to simultaneously maintain =
alignment=20
between the months and the seasons and synchronise months with the =
Moon=97it is=20
thus deemed a =93*luni-solar calendar*=94. In addition, there are =
constraints=20
on which days of the week on which a year can begin and to shift =
otherwise=20
required extra days to prior years to keep the length of the year within =
the=20
prescribed bounds. This isn't easy, and the computations required are=20
correspondingly intricate.

Years are classified as *common* (normal) or =
*embolismic*=20
(leap) years which occur in a 19 year cycle in years 3, 6, 8, 11, 14, =
17, and=20
19. In an embolismic (leap) year, an extra *month* of 29 days, =
=93Veadar=94=20
or =93Adar II=94, is added to the end of the year after the month =
=93Adar=94, which=20
is designated =93Adar I=94 in such years. Further, years may be=20
*deficient*, *regular*, or *complete*, having =
respectively=20
353, 354, or 355 days in a common year and 383, 384, or 385 days in =
embolismic=20
years. Days are defined as beginning at sunset, and the calendar begins =
at=20
sunset the night before Monday, October 7, 3761 B.C.E.=20
in the Julian calendar, or Julian day 347995.5. Days are numbered with =
Sunday as=20
day 1, through Saturday: day 7.

The average length of a month is 29.530594 days, extremely close to =
the mean=20
*synodic month* (time from new Moon to next new Moon) of =
29.530588 days.=20
Such is the accuracy that more than 13,800 years elapse before a single =
day=20
discrepancy between the calendar's average reckoning of the start of =
months and=20
the mean time of the new Moon. Alignment with the solar year is better =
than the=20
Julian calendar, but inferior to the Gregorian. The average length of a =
year is=20
365.2468 days compared to the actual solar tropical year (time from =
equinox to=20
equinox) of 365.24219 days, so the calendar accumulates one day of error =
with=20
respect to the solar year every 216 years.

The Islamic calendar is purely lunar and consists of twelve =
alternating=20
months of 30 and 29 days, with the final 29 day month extended to 30 =
days during=20
leap years. Leap years follow a 30 year cycle and occur in years 1, 5, =
7, 10,=20
13, 16, 18, 21, 24, 26, and 29. Days are considered to begin at sunset. =
The=20
calendar begins on Friday, July 16th, 622 C.E. =
in the=20
Julian calendar, Julian day 1948439.5, the day of Muhammad's flight from =
Mecca=20
to Medina, with sunset on the preceding day reckoned as the first day of =
the=20
first month of year 1 A.H.=97=93*Anno =
Hegir=E6*=94=97the=20
Arabic word for =93separate=94 or =93go away=94. The names for the days =
are just their=20
numbers: Sunday is the first day and Saturday the seventh; the week is=20
considered to begin on Saturday.

Each cycle of 30 years thus contains 19 normal years of 354 days and =
11 leap=20
years of 355, so the average length of a year is therefore ((19 =D7 354) =
+ (11 =D7=20
355)) / 30 =3D 354.365=85 days, with a mean length of month of 1/12 this =
figure, or=20
29.53055=85 days, which closely approximates the mean *synodic =
month* (time=20
from new Moon to next new Moon) of 29.530588 days, with the calendar =
only=20
slipping one day with respect to the Moon every 2525 years. Since the =
calendar=20
is fixed to the Moon, not the solar year, the months shift with respect =
to the=20
seasons, with each month beginning about 11 days earlier in each =
successive=20
solar year.

The calendar presented here is the most commonly used civil calendar =
in the=20
Islamic world; for religious purposes months are defined to start with =
the first=20
observation of the crescent of the new Moon.

The modern Persian calendar was adopted in 1925, supplanting (while = retaining=20 the month names of) a traditional calendar dating from the eleventh = century. The=20 calendar consists of 12 months, the first six of which are 31 days, the = next=20 five 30 days, and the final month 29 days in a normal year and 30 days = in a leap=20 year.

As one of the few calendars designed in the era of accurate =
positional=20
astronomy, the Persian calendar uses a very complex leap year structure =
which=20
makes it the most accurate solar calendar in use today. Years are =
grouped into=20
*cycles* which begin with four normal years after which every =
fourth=20
subsequent year in the cycle is a leap year. Cycles are grouped into =
*grand=20
cycles* of either 128 years (composed of cycles of 29, 33, 33, and =
33 years)=20
or 132 years, containing cycles of of 29, 33, 33, and 37 years. A =
*great=20
grand cycle* is composed of 21 consecutive 128 year grand cycles and =
a final=20
132 grand cycle, for a total of 2820 years. The pattern of normal and =
leap years=20
which began in 1925 will not repeat until the year 4745!

Each 2820 year great grand cycle contains 2137 normal years of 365 =
days and=20
683 leap years of 366 days, with the average year length over the great =
grand=20
cycle of 365.24219852. So close is this to the actual solar tropical =
year of=20
365.24219878 days that the Persian calendar accumulates an error of one =
day only=20
every 3.8 million years. As a purely solar calendar, months are not =
synchronised=20
with the phases of the Moon.

The Mayans employed three calendars, all organised as hierarchies of =
cycles=20
of days of various lengths. The *Long Count* was the principal =
calendar=20
for historical purposes, the *Haab* was used as the civil =
calendar, while=20
the *Tzolkin* was the religious calendar. All of the Mayan =
calendars are=20
based on serial counting of days without means for synchronising the =
calendar to=20
the Sun or Moon, although the Long Count and Haab calendars contain =
cycles of=20
360 and 365 days, respectively, which are roughly comparable to the =
solar year.=20
Based purely on counting days, the Long Count more closely resembles the =
Julian=20
Day system and contemporary computer representations of date and time =
than other=20
calendars devised in antiquity. Also distinctly modern in appearance is =
that=20
days and cycles count from zero, not one as in most other calendars, =
which=20
simplifies the computation of dates, and that numbers as opposed to =
names were=20
used for all of the cycles.

Cycle | Composed of | Total Days |
Years (approx.) |
---|---|---|---|

kin |
1 | ||

uinal |
20 kin | 20 | |

tun |
18 uinal | 360 | 0.986 |

katun |
20 tun | 7200 | 19.7 |

baktun |
20 katun | 144,000 | 394.3 |

pictun |
20 baktun | 2,880,000 | 7,885 |

calabtun |
20 piktun | 57,600,000 | 157,704 |

kinchiltun |
20 calabtun | 1,152,000,000 | 3,154,071 |

alautun |
20 kinchiltun | 23,040,000,000 | 63,081,429 |

The Long Count calendar is organised into the hierarchy of cycles =
shown at=20
the right. Each of the cycles is composed of 20 of the next shorter =
cycle with=20
the exception of the *tun*, which consists of 18 *uinal* =
of 20=20
days each. This results in a *tun* of 360 days, which maintains=20
approximate alignment with the solar year over modest intervals=97the =
calendar=20
comes undone from the Sun 5 days every *tun*.

The Mayans believed at at the conclusion of each *pictun* =
cycle of=20
about 7,885 years the universe is destroyed and re-created. Those with=20
apocalyptic inclinations will be relieved to observe that the present =
cycle will=20
not end until Columbus Day, October 12, 4772 in the Gregorian calendar. =
Speaking=20
of apocalyptic events, it's amusing to observe that the longest of the =
cycles in=20
the Mayan calendar, *alautun*, about 63 million years, is =
comparable to=20
the 65 million years since the impact which brought down the curtain on =
the=20
dinosaurs=97an impact which occurred near the Yucatan peninsula where, =
almost an=20
*alautun* later, the Mayan civilisation flourished. If the =
universe is=20
going to be destroyed and the end of the current *pictun*, =
there's no=20
point in writing dates using the longer cycles, so we dispense with them =
here.=20

Dates in the Long Count calendar are written, by convention, as:

*baktun* **.** *katun* **.**=
*tun* **.** *uinal* **.** <=
EM>kin=20

and thus resemble present-day Internet IP addresses!

For civil purposes the Mayans used the *Haab* calendar in =
which the=20
year was divided into 18 named periods of 20 days each, followed by five =
*Uayeb* days not considered part of any period. Dates in this =
calendar=20
are written as a day number (0 to 19 for regular periods and 0 to 4 for =
the days=20
of *Uayeb*) followed by the name of the period. This calendar has =
no=20
concept of year numbers; it simply repeats at the end of the complete =
365 day=20
cycle. Consequently, it is not possible, given a date in the Haab =
calendar, to=20
determine the Long Count or year in other calendars. The 365 day cycle =
provides=20
better alignment with the solar year than the 360 day *tun* of =
the Long=20
Count but, lacking a leap year mechanism, the Haab calendar shifted one =
day with=20
respect to the seasons about every four years.

The Mayan religion employed the *Tzolkin* calendar, composed =
of 20=20
named periods of 13 days. Unlike the Haab calendar, in which the day =
numbers=20
increment until the end of the period, at which time the next period =
name is=20
used and the day count reset to 0, the names and numbers in the Tzolkin =
calendar=20
advance in parallel. On each successive day, the day number is =
incremented by 1,=20
being reset to 0 upon reaching 13, and the next in the cycle of twenty =
names is=20
affixed to it. Since 13 does not evenly divide 20, there are thus a =
total of 260=20
day number and period names before the calendar repeats. As with the =
Haab=20
calendar, cycles are not counted and one cannot, therefore, convert a =
Tzolkin=20
date into a unique date in other calendars. The 260 day cycle formed the =
basis=20
for Mayan religious events and has no relation to the solar year or =
lunar month.=20

The Mayans frequently specified dates using *both* the Haab =
and=20
Tzolkin calendars; dates of this form repeat only every 52 solar years. =

The Bah=E1'=ED calendar is a solar calendar organised as a hierarchy =
of cycles,=20
each of length 19, commemorating the 19 year period between the 1844=20
proclamation of the B=E1b in Shiraz and the revelation by Bah=E1'u'll=E1h in =
1863. Days are=20
named in a cycle of 19 names. Nineteen of these cycles of 19 days, =
usually=20
called =93months=94 even though they have nothing whatsoever to do with =
the Moon,=20
make up a year, with a period between the 18th and 19th months referred =
to as=20
*Ayy=E1m-i-H=E1* not considered part of any month; this period is =
four days=20
in normal years and five days in leap years. The rule for leap years is=20
identical to that of the Gregorian calendar, so the Bah=E1'=ED calendar =
shares its=20
accuracy and remains synchronised. The same cycle of 19 names is used =
for days=20
and months.

The year begins at the equinox, March 21, the Feast of Naw-R=FAz; =
days begin at=20
sunset. Years have their own cycle of 19 names, called the =
*V=E1hid*.=20
Successive cycles of 19 years are numbered, with cycle 1 commencing on =
March 21,=20
1844, the year in which the B=E1b announced his prophecy. Cycles, in =
turn, are=20
assembled into *Kull-I-Shay* super-cycles of 361 (19=B2) years. =
The first=20
*Kull-I-Shay* will not end until Gregorian calendar year 2205. A =
week of=20
seven days is superimposed on the calendar, with the week considered to =
begin on=20
Saturday. Confusingly, three of the names of weekdays are identical to =
names in=20
the 19 name cycles for days and months.

A bewildering variety of calendars have been and continue to be used = in the=20 Indian subcontinent. In 1957 the Indian government's Calendar Reform = Committee=20 adopted the National Calendar of India for civil purposes and, in = addition,=20 defined guidelines to standardise computation of the religious calendar, = which=20 is based on astronomical observations. The civil calendar is used = throughout=20 India today for administrative purposes, but a variety of religious = calendars=20 remain in use. We present the civil calendar here.

The National Calendar of India is composed of 12 months. The first =
month,=20
*Caitra*, is 30 days in normal and 31 days in leap years. This is =
followed by five consecutive 31 day months, then six 30 day months. Leap =
years=20
in the Indian calendar occur in the same years as as in the Gregorian =
calendar;=20
the two calendars thus have identical accuracy and remain synchronised. =

Years in the Indian calendar are counted from the start of the Saka =
Era, the=20
equinox of March 22nd of year 79 in the Gregorian calendar, designated =
day 1 of=20
month Caitra of year 1 in the Saka Era. The calendar was officially =
adopted on 1=20
Caitra, 1879 Saka Era, or March 22nd, 1957 Gregorian. Since year 1 of =
the Indian=20
calendar differs from year 1 of the Gregorian, to determine whether a =
year in=20
the Indian calendar is a leap year, add 78 to the year of the Saka era =
then=20
apply the Gregorian calendar rule to the sum.

The calendar consists of 12 months of 30 days each, followed by a =
five- or=20
six-day holiday period, the *jours =
compl=E9mentaires*=20
or *sans-culottides*. Months are =
grouped into four=20
seasons; the three months of each season end with the same letters and =
rhyme=20
with one another. The calendar begins on Gregorian date September 22nd, =
1792,=20
the September equinox and date of the founding of the First Republic. =
This day=20
is designated the first day of the month of Vend=E9miaire in year 1 of =
the=20
Republic. Subsequent years begin on the day in which the September =
equinox=20
occurs as reckoned at the Paris meridian. Days begin at true solar =
midnight.=20
Whether the *sans-culottides* period =
contains five=20
or six days depends on the actual date of the equinox. Consequently, =
there is no=20
leap year rule *per se*: 366 day years =
do not recur=20
in a regular pattern but instead follow the dictates of astronomy. The =
calendar=20
therefore stays perfectly aligned with the seasons. No attempt is made =
to=20
synchronise months with the phases of the Moon.

The Republican calendar is rare in that it has no concept of a seven =
day=20
week. Each thirty day month is divided into three *d=E9cades* of ten days each, the last of which, *d=E9cadi*, was the day of rest. (The word =93*d=E9cade*=94 may confuse English speakers; the =
French noun=20
denoting ten years is =93*d=E9cennie*=94.) The names of=20
days in the *d=E9cade* are derived from =
their number=20
in the ten day sequence. The five or six days of the *sans-culottides* do not bear the names of the *d=E9cade*. Instead, each of these holidays =
commemorates an=20
aspect of the republican spirit. The last, *jour de la=20
R=E9volution*, occurs only in years of 366 days.

Napol=E9on abolished the Republican calendar in favour of the = Gregorian on=20 January 1st, 1806. Thus France, one of the first countries to adopt the=20 Gregorian calendar (in December 1582), became the only country to = subsequently=20 abandon and then re-adopt it. During the period of the Paris Commune = uprising in=20 1871 the Republican calendar was again briefly used.

The original decree which established the Republican =
calendar=20
contained a contradiction: it defined the year as starting on the day of =
the=20
true autumnal equinox in Paris, but further prescribed a four year cycle =
called=20
*la Franciade*, the fourth year of =
which would end=20
with *le jour de la R=E9volution* and =
hence contain=20
366 days. These two specifications are incompatible, as 366 day years =
defined by=20
the equinox do not recur on a regular four year schedule. This problem =
was=20
recognised shortly after the calendar was proclaimed, but the calendar =
was=20
abandoned five years before the first conflict would have occurred and =
the issue=20
was never formally resolved. Here we assume the equinox rule prevails, =
as a=20
rigid four year cycle would be no more accurate than the Julian =
calendar, which=20
couldn't possibly be the intent of its enlightened Republican designers. =

The International =
Standards=20
Organisation (ISO) issued Standard ISO 8601, =93Representation of =
Dates=94 in=20
1988, superseding the earlier ISO 2015. The bulk of the standard =
consists of=20
standards for representing dates in the Gregorian calendar including the =
highly=20
recommended =93**YYYY-MM-DD**=94 form which is unambiguous, free of =
cultural=20
bias, can be sorted into order without rearrangement, and is Y9K =
compliant. In=20
addition, ISO 8601 formally defines the =93calendar week=94 often =
encountered in=20
commercial transactions in Europe. The first calendar week of a year: =
week 1, is=20
that week which contains the first Thursday of the year (or, =
equivalently, the=20
week which includes January 4th of the year; the first day of that week =
is the=20
previous Monday). The last week: week 52 or 53 depending on the date of =
Monday=20
in the first week, is that which contains December 28th of the year. The =
first=20
ISO calendar week of a given year starts with a Monday which can be as =
early as=20
December 29th of the previous year or as late as January 4th of the =
present; the=20
last calendar week can end as late as Sunday, January 3rd of the =
subsequent=20
year. ISO 8601 dates in year, week, and day form are written with a =
=93W=94=20
preceding the week number, which bears a leading zero if less than 10, =
for=20
example February 29th, 2000 is written as 2000-02-29 in year, month, day =
format=20
and 2000-W09-2 in year, week, day form; since the day number can never =
exceed 7,=20
only a single digit is required. The hyphens may be elided for brevity =
and the=20
day number omitted if not required. You will frequently see date of =
manufacture=20
codes such as =9300W09=94 stamped on products; this is an abbreviation =
of 2000-W09,=20
the ninth week of year 2000.

In solar calendars such as the Gregorian, only days and years have = physical=20 significance: days are defined by the rotation of the Earth, and years = by its=20 orbit about the Sun. Months, decoupled from the phases of the Moon, are = but a=20 memory of forgotten lunar calendars, while weeks of seven days are = entirely a=20 social construct=97while most calendars in use today adopt a cycle of = seven day=20 names or numbers, calendars with name cycles ranging from four to sixty = days=20 have been used by other cultures in history.

ISO 8601 permits us to jettison the historical and cultural baggage =
of weeks=20
and months and express a date simply by the year and day number within =
that=20
year, ranging from 001 for January 1st through 365 (366 in a leap year) =
for=20
December 31st. This format makes it easy to do arithmetic with dates =
within a=20
year, and only slightly more complicated for periods which span year =
boundaries.=20
You'll see this representation used in project planning and for =
specifying=20
delivery dates. ISO dates in this form are written as =
=93**YYYY-DDD**=94, for=20
example 2000-060 for February 29th, 2000; leading zeroes are always =
written in=20
the day number, but the hyphen may be omitted for brevity.

All ISO 8601 date formats have the advantages of being fixed length =
(at least=20
until the Y10K crisis rolls around) and, when stored in a computer, of =
being=20
sorted in date order by an alphanumeric sort of their textual =
representations.=20
The ISO week and day and day of year calendars are derivative of the =
Gregorian=20
calendar and share its accuracy.

Development of the Unix operating system began at Bell Laboratories = in 1969=20 by Dennis Ritchie and Ken Thompson, with the first PDP-11 version = becoming=20 operational in February 1971. Unix wisely adopted the convention that = all=20 internal dates and times (for example, the time of creation and last=20 modification of files) were kept in Universal Time, and converted to = local time=20 based on a per-user time zone specification. This far-sighted choice has = made it=20 vastly easier to integrate Unix systems into far-flung networks without = a chaos=20 of conflicting time settings.

Many machines on which Unix was initially widely deployed could not =
support=20
arithmetic on integers longer than 32 bits without costly =
multiple-precision=20
computation in software. The internal representation of time was =
therefore=20
chosen to be the number of seconds elapsed since 00:00 Universal time on =
January=20
1, 1970 in the Gregorian calendar (Julian day 2440587.5), with time =
stored as a=20
32 bit signed integer (`long` in early C implementations).

The influence of Unix time representation has spread well beyond Unix =
since=20
most C and C++ libraries on other systems provide Unix-compatible time =
and date=20
functions. The major drawback of Unix time representation is that, if =
kept as a=20
32 bit signed quantity, on January 19, 2038 it will go negative, =
resulting in=20
chaos in programs unprepared for this. Unix and C implementations wisely =
(for=20
reasons described below) define the result of the `time()` =
function as=20
type `time_t`, which leaves the door open for remediation (by =
changing=20
the definition to a 64 bit integer, for example) before the clock ticks =
the=20
dreaded doomsday second.

C compilers on Unix systems prior to 7th Edition lacked the 32-bit=20
`long` type. On earlier systems `time_t`, the value =
returned by=20
the `time()` function, was an array of two 16-bit `int`s =
which,=20
concatenated, represented the 32-bit value. This is the reason why=20
`time()` accepts a pointer argument to the result (prior to 7th =
Edition=20
it returned a status, not the 32-bit time) and `ctime()` requires =
a=20
pointer to its input argument. Thanks to Eric Allman (author of=20
`sendmail`) for pointing out these historical nuggets.

Spreadsheet calculations frequently need to do arithmetic with date =
and time=20
quantities=97for example, calculating the interest on a loan with a =
given term.=20
When Microsoft Excel was introduced for the PC Windows platform, it =
defined=20
dates and times as =93serial values=94, which express dates and times as =
the number=20
of days elapsed since midnight on January 1, 1900 with time given as a =
fraction=20
of a day. Midnight on January 1, 1900 is day 1.0 in this scheme. Time =
zone is=20
unspecified in Excel dates, with the `NOW()` function returning =
whatever=20
the computer's clock is set to=97in most cases local time, so when =
combining data=20
from machines in different time zones you usually need to add or =
subtract the=20
bias, which can differ over the year due to observance of summer time. =
Here we=20
assume Excel dates represent Universal (Greenwich Mean) time, since =
there isn't=20
any other rational choice. But don't assume you can always get away with =
this.=20

You'd be entitled to think, therefore, that conversion back and forth =
between=20
PC Excel serial values and Julian day numbers would simply be a matter =
of adding=20
or subtracting the Julian day number of December 31, 1899 (since the PC =
Excel=20
days are numbered from 1). But this is a *Microsoft* calendar, =
remember,=20
so one must first look to make sure it doesn't contain one of those =
bonehead=20
blunders characteristic of Microsoft. As is usually the case, one =
doesn't have=20
to look very far. If you have a copy of PC Excel, fire it up, format a =
cell as=20
containing a date, and type 60 into it: out pops =93February 29, =
1900=94. News=20
apparently travels *very* slowly from Rome to Redmond=97ever =
since Pope=20
Gregory revised the calendar in 1582, years divisible by 100 =
have=20
*not* been leap years, and consequently the year 1900 contained =
no=20
February 29th. Due to this morsel of information having been lost =
somewhere=20
between the Holy See and the Infernal =
Seattle=20
monopoly, all Excel day numbers for days subsequent to February 28th, =
1900 are=20
one day greater than the actual day count from January 1, 1900. Further, =
note=20
that any computation of the number of days in a period which begins in =
January=20
or February 1900 and ends in a subsequent month will be off by one=97the =
day count=20
will be one greater than the actual number of days elapsed.

By the time the 1900 blunder was discovered, Excel users had created =
millions=20
of spreadsheets containing incorrect day numbers, so Microsoft decided =
to leave=20
the error in place rather than force users to convert their =
spreadsheets, and=20
the error remains to this day. Note, however, that *only 1900* is =
affected; while the first release of Excel probably also screwed up all =
years=20
divisible by 100 and hence implemented a purely Julian calendar, =
contemporary=20
versions do correctly count days in 2000 (which is a leap year, being =
divisible=20
by 400), 2100, and subsequent end of century years.

PC Excel day numbers are valid only between 1 (January 1, 1900) and =
2958465=20
(December 31, 9999). Although a serial day counting scheme has no =
difficulty=20
coping with arbitrary date ranges or days before the start of the epoch =
(given=20
sufficient precision in the representation of numbers), Excel doesn't do =
so. Day=20
0 is deemed the idiotic January 0, 1900 (at least in Excel 97), and =
negative=20
days and those in Y10K and beyond are not handled at all. Further, old =
versions=20
of Excel did date arithmetic using 16 bit quantities and did not support =
day=20
numbers greater than 65380 (December 31, 2078); I do not know in which =
release=20
of Excel this limitation was remedied.

Having saddled every PC Excel user with a defective date numbering =
scheme=20
wasn't enough for Microsoft=97nothing ever is. Next, they proceeded to =
come out=20
with a Macintosh version of Excel which uses an *entirely =
different* day=20
numbering system based on the MacOS native time format which counts =
seconds=20
elapsed since January 1, 1904. To further obfuscate matters, on the =
Macintosh=20
they chose to number days from zero rather than 1, so midnight on =
January 1,=20
1904 has serial value 0.0. By starting in 1904, they avoided screwing up =
1900 as=20
they did on the PC. So now Excel users who interchange data have to cope =
with=20
two incompatible schemes for counting days, one of which thinks 1900 was =
a leap=20
year and the other which doesn't go back that far. To compound the fun, =
you can=20
now select either date system on either platform, so you can't be =
certain dates=20
are compatible even when receiving data from another user with same kind =
of=20
machine you're using. I'm sure this was all done in the interest of the=20
=93efficiency=94 of which Microsoft is so fond. As we all know, it would =
take a=20
computer *almost forever* to add or subtract four in order to =
make=20
everything seamlessly interchangeable.

Macintosh Excel day numbers are valid only between 0 (January 1, =
1904) and=20
2957003 (December 31, 9999). Although a serial day counting scheme has =
no=20
difficulty coping with arbitrary date ranges or days before the start of =
the=20
epoch (given sufficient precision in the representation of numbers), =
Excel=20
doesn't do so. Negative days and those in Y10K and beyond are not =
handled at=20
all. Further, old versions of Excel did date arithmetic using 16 bit =
quantities=20
and did not support day numbers greater than 63918 (December 31, 2078); =
I do not=20
know in which release of Excel this limitation was remedied.

Click on titles to order books on-line from |

- Meeus, Jean. Astronomical Algorithms 2nd ed. = Richmond:=20 Willmann-Bell, 1998. ISBN 0943396-61-1.=20
- The essential reference for computational positional astronomy.=20
- P. Kenneth Seidelmann (ed.) Explanatory Supplement to the Astronomical = Almanac=20 . Sausalito CA: University Science Books, [1992] 2005. ISBN = 1-891389-45-9.=20
- Authoritative reference on a wealth of topics related to = computational=20 geodesy and astronomy. Various calendars are described in depth, = including=20 techniques for interconversion.=20
- The Institut de=20 m=E9canique c=E9leste et de calcul des =E9ph=E9m=E9rides in Paris = provides excellent=20 on-line descriptions of a variety of calendars.

June, MMVI=20