bhagolblog

Computed sky · Meghnad Chitnis

The day number that every ephemeris agrees on

Every astronomy program turns your date into one running count of days. The Julian Day built from scratch, worked forward to a number and back to a date.

Two ways in. The gist assumes you have never met any of this before.

A torn fragment of brown papyrus mounted flat on a pale ground and photographed from above. Its surface is ruled into a grid by faint red lines, and each small cell holds two or three Greek letters in dark ink, the letters standing in for numerals. The columns run in short repeated groups down the fragment; several lines are broken away at the edges, where loose fibres stand out along the tears.
Astronomical table on papyrus (P. Ryl. Gr. III 523), Egypt, 3rd century CE. The University of Manchester Library via Wikimedia Commons, CC BY-SA 4.0. Share-alike applies to this crop.

The Julian Day is a single running count of days, and it is the one piece of arithmetic every astronomy program shares. It is the column down the left-hand edge of any table of computed sky positions, a seven-digit number with a decimal point: 2455034.5, then 2455035.5, line after line to the bottom of the page. The dates are printed too, as a courtesy. The number is what the program reads. Chart software is no exception: before a single planet is looked up, the date you typed is turned into one of these numbers, at the head of the pipeline that turns a birth moment into a chart.

The reason is that dates are poor at arithmetic. Months are of unequal length. Most years have 365 days and some have 366. Countries changed calendars in different decades, and several struck out 10 or 11 dates when they did. A count of days is untroubled by any of it. Day 2,455,035 follows day 2,455,034 in every country and every century.

Three conventions come with the count.

It begins at noon. The US Naval Observatory defines the Julian Date as a continuous count of days from Greenwich mean noon; an astronomer working through a night wanted the whole night inside one number rather than cut in half at twelve o'clock. So midnight falls on a half: zero hours Universal Time lands on a day number ending in .5, and the whole number arrives at lunchtime.

Day zero begins at noon on 1 January 4713 BCE, reckoned in the Julian calendar run backwards to a time when nobody used it. Astronomers write that year as −4712, because they keep a year zero and historians do not. Nothing happened that day. It sits far enough back that every date anyone wants gets a positive number, which was the whole requirement.

And the name is a trap. The Julian calendar is a calendar: Julius Caesar's, one leap day every fourth year with no exceptions, used across Europe until 1582 and in places longer still. The Julian Day is not a calendar at all. It is a count. Joseph Scaliger set out the 7,980-year Julian Period in a book on the reckoning of time in 1583, multiplying three old cycles of 19, 28 and 15 years, and the name most likely comes from the Julian year he built it on. A date can be Julian or Gregorian. A day number is neither, and that is the point of it.

What follows is one real date turned into its number, then the number turned back into the date. I have taken 22 July 2009. That morning the Moon's shadow crossed India from the Gujarat coast to Bihar, over Surat, Bhopal, Varanasi and Patna. Out over the Pacific the total phase ran 6 minutes and 39 seconds, the longest this century will see. The arithmetic does not depend on the eclipse; I wanted a date people stood outside for.

Turning the date into a number

Four steps. Throughout, dividing means keeping the whole number and dropping whatever is left over.

One. Move the start of the year to 1 March. January and February are counted as part of the year before. This puts the leap day at the end of the year, where it is added on cleanly instead of interrupting the middle.

Two. Count the days in the years already finished. That is 365 for each year, plus the leap days, which come from three divisions: add one for every four years, take away one for every hundred, put back one for every four hundred.

Three. Count the days from 1 March to the date itself, month by month.

Four. Add one fixed number that lines your count up with the Julian Day scale.

That constant is not something to take on trust: pin it with one published value. The Naval Observatory prints worked examples beside its conversion formula; one is that 1 January 1978 at zero hours Universal Time is JD 2,443,509.5.

Work my count for that date. It is January, so the year becomes 1977, and 1 January stands 306 days after 1 March 1977, March through December added up. Then 365 × 1977 = 721,605, and 1977 ÷ 4 = 494, and 1977 ÷ 100 = 19, and 1977 ÷ 400 = 4. So 721,605 + 494 − 19 + 4 = 722,084, and adding the 306 gives 722,390.

Subtract that from the published value: 2,443,509.5 − 722,390 = 1,721,119.5. That is the constant, and it means something: the Julian Day of midnight at the start of 1 March in the year 0, with the Gregorian rules run backwards into an era that never used them.

Now the eclipse morning. July, so nothing moves: the year stays 2009.

365 × 2009 is 730,000 plus 3,285, which is 733,285. Then 2009 ÷ 4 = 502, and 2009 ÷ 100 = 20, and 2009 ÷ 400 = 5. So 733,285 + 502 − 20 + 5 = 733,772.

From 1 March to 1 July is 31 + 30 + 31 + 30 = 122 days, and 22 July is 21 days after that: 143.

733,772 + 143 = 733,915 days, and 733,915 + 1,721,119.5 = 2,455,034.5. That is midnight at the start of the day, in Universal Time.

A time of day is a fraction added on. NASA's eclipse catalogue puts greatest eclipse, far out in the Pacific, at 02:36:25 in the uniform scale used for such predictions, with a correction of 66 seconds to Universal Time that year: 02:35:19, which is 9,319 seconds. A day is 86,400 seconds. 9,319 ÷ 86,400 = 0.10786, so the instant is JD 2,455,034.60786. Note where the whole number sits: 2,455,034 exactly was the previous lunchtime.

Two checks, both cheap. The Naval Observatory's other example, 11 August 1877 at 7h 30m, comes out of the same four steps at 2,406,842.8125, exactly as printed. And JPL's Horizons service prints 2455034.500000000 against 2009-Jul-22 00:00 UT.

Turning the number back into a date

Six steps, and the divisors are the interesting part.

Subtract the constant: 2,455,034.5 − 1,721,119.5 = 733,915, with nothing left over. (A fraction left over would be the time of day, counted from midnight.)

Then divide by four numbers that each mean something.

Four hundred Gregorian years hold 146,097 days: 400 × 365 = 146,000, plus 100 leap days, minus the 4 century years skipped, plus the 1 put back. So 733,915 ÷ 146,097 = 5, and 5 × 146,097 = 730,485, leaving 3,430. Five cycles is 2,000 years.

A century inside the cycle holds 36,524 days. 3,430 ÷ 36,524 = 0. Nothing to take; 3,430 still stands.

Four years hold 1,461 days. 3,430 ÷ 1,461 = 2, and 2 × 1,461 = 2,922, leaving 508. That is 8 more years.

A year holds 365 days. 508 ÷ 365 = 1, leaving 143. One more year.

Add them: 2,000 + 0 + 8 + 1 = 2,009, and the date stands 143 days past 1 March. Count the months off: 143 − 31 for March is 112; − 30 for April is 82; − 31 for May is 51; − 30 for June is 21. Twenty-one whole days past 1 July puts us on the twenty-second. The month is after February, so the year needs no adjusting. The twenty-second of July, 2009, recovered without being told.

Two small guards belong here. The century figure and the single-year figure are each capped at three. Skip the caps, and one date goes wrong: the 29 February that closes a four-hundred-year cycle. For that day alone the division runs one step past the truth and hands back 1 March of the wrong year. Our date sits early in its cycle and touches neither guard.

Now the two things the count does not settle.

The first is which calendar the date was written in. For a date before the reform you use the older rule: a leap year every fourth year with no exceptions, one division instead of three, and a constant two days lower at 1,721,117.5. Put 4 October 1582 through the old rule and you get 2,299,159.5; put 15 October 1582, Rome's first day of the new calendar, through the new one and you get 2,299,160.5. Consecutive midnights: the 10 dates struck out cost the count nothing. Hand an old-style date to the new-style rule without saying so, and the four steps answer confidently, 10 days wrong.

The second is which clock. The count runs on Universal Time, kept by the turning earth. Planetary theory runs on a uniform scale ahead of it by tens of seconds, and the gap is measured rather than derived: 66 seconds in 2009, as the eclipse catalogue records. A day number is not an instant until you say which of the two it carries.

Where a day begins is a convention too. Astronomers who dislike the noon start use the Modified Julian Date, the Julian Day minus 2,400,000.5, which begins at midnight. A civil day in India begins at sunrise, and a tithi (तिथि), the lunar day a panchang is built on, is not a day of that kind at all: it ends whenever the Moon has gained another 12 degrees on the Sun, which is a working Priya has already set out. (Indian astronomy keeps its own running day count, the ahargaṇa (अहर्गण), from an epoch of its own. That needs a page and a worked example, not a sentence here.)

There is a round number coming. Day 2,500,000: subtract the constant and you have 778,880 days and a half. Divide by 146,097 and take 5, leaving 48,395; divide by 36,524 and take 1, leaving 11,871; divide by 1,461 and take 8, leaving 183; divide by 365 and take nothing. That is 2,000 + 100 + 32 years, so 2132, and 183 days past 1 March, which the months count off as 31 August. The half day left over is noon.

Noon on 31 August 2132, then, 106 years from here, and the working needed nothing about the intervening centuries: no reform, no time zone, only the four divisors in order. Horizons agrees. So will anybody's program, and so will yours.