Calendar Converter

Welcome to Fourmilab's calendar converter! This page allows you to interconvert dates in a variety of calendars, both civil and computer-related. All calculations are done in JavaScript executed in your own browser; complete source code is embedded in this page, and you're free to save the page into a file on your own computer and use it even when not connected to the Internet. To use the page, your browser must support JavaScript and you must not have disabled execution of that language. Let's see...

If the box above says "Your browser supports JavaScript", you're in business; simply enter a date in any of the boxes below and press the "Calculate" button to show that date in all of the other calendars.

Gregorian Calendar

Time: ::
The Gregorian calendar was proclaimed by Pope Gregory XIII and took effect in most Catholic states in 1582, in which October 5, 1582 of the Julian calendar was followed by October 15 in the new calendar, correcting for the accumulated discrepancy between the Julian calendar and the equinox as of that date. When comparing historical dates, it's important to note that the Gregorian calendar, used universally today in Western countries and in international commerce, was adopted at different times by different countries. Britain and her colonies (including what is now the United States), did not switch to the Gregorian calendar until 1752, when Wednesday 2nd September in the Julian calendar dawned as Thursday the 14th in the Gregorian.

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

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

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

Julian Day

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

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

Julian Calendar

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

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

Hebrew Calendar

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

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

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

Islamic Calendar

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

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

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

Persian Calendar

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

As one of the few calendars designed in the era of accurate positional astronomy, the Persian calendar uses a very complex leap year structure which makes it the most accurate solar calendar in use today. Years are grouped into cycles which begin with four normal years after which every fourth subsequent year in the cycle is a leap year. Cycles are grouped into grand cycles of either 128 years (composed of cycles of 29, 33, 33, and 33 years) or 132 years, containing cycles of of 29, 33, 33, and 37 years. A great grand cycle is composed of 21 consecutive 128 year grand cycles and a final 132 grand cycle, for a total of 2820 years. The pattern of normal and leap years 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 683 leap years of 366 days, with the average year length over the great grand cycle of 365.24219852. So close is this to the actual solar tropical year of 365.24219878 days that the Persian calendar accumulates an error of one day only every 3.8 million years. As a purely solar calendar, months are not synchronised with the phases of the Moon.

ISO-8601 Week and Day

Day of week of year
The International Standards Organisation (ISO) issued Standard ISO 8601, "Representation of Dates" in 1988, superseding the earlier ISO 2015. The bulk of the standard consists of standards for representing dates in the Gregorian calendar including the highly recommended "YYYY-MM-DD" form which is unambiguous, free of cultural bias, can be sorted into order without rearrangement, and is Y9K compliant. In addition, ISO 8601 formally defines the "calendar week" often encountered in commercial transactions in Europe. The first calendar week of a year: week 1, is that week which contains the first Thursday of the year (or, equivalently, the week which includes January 4th of the year; the first day of that week is the previous Monday). The last week: week 52 or 53 depending on the date of Monday in the first week, is that which contains December 31 of the year. The first ISO calendar week of a given year starts with a Monday which can be as early as December 29th of the previous year or as late as January 4th of the present; the last calendar week can end as late as Sunday, January 3rd of the subsequent year.

The ISO week calendar is a derivative of the Gregorian calendar and shares its accuracy.

Unix time() value

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

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

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

Excel Serial Day Number

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

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

By the time the 1900 blunder was discovered, Excel users had created millions of spreadsheets containing incorrect day numbers, so Microsoft decided to leave the error in place rather than force users to convert their spreadsheets, and 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 divisible by 100 and hence implemented a purely Julian calendar, contemporary versions do correctly count days in 2000 (which is a leap year, being divisible by 400), 2100, and subsequent end of century years.

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

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

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


Meeus, Jean. Astronomical Algorithms . Richmond: Willmann-Bell, 1991. ISBN 0-943396-35-2.
The essential reference for computational positional astronomy.

by John Walker
December, MIM
This document is in the public domain.