Skip to content

johanley/julian-date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

julian-date

Julian dates let you do date calculations without messing about with the often complex details of traditional calendars.

Tools are needed to convert between calendar dates and Julian dates. The problem is that most implementations of such conversions:

  • don't support negative Julian dates
  • read like cryptic incantations addressed to a long-forgotten god

This little project provides an algorithm for Julian dates that:

  • doesn't restrict the date in any way
  • has a large number of unit tests
  • is not cryptic, and can be read and understood

Implementations are provided in C99 and Java.

The implementation is for dates in the Gregorian calendar only. (Creating a version for the Julian calendar is possible by changing its leap-year logic).

It's somewhat suprising that so many tools restrict the date:

(Here's an example taken from an online calculator from the JPL that's just plain wrong. The input date is the origin of the Julian period as expressed in the Julian calendar. In the Gregorian calendar, that day is -4713-11-24.)

The 1968 Algorithm Requiring Julian Date >= 0

The Explanatory Supplement (1992), page 604 has an implementation that looks like this.

The Explanatory Supplement (2006), page 604 repeats the same algorithm, shown here.

The above two references are considered authoritative by professional astronomers. Both of these references cite this 1968 paper by Fliegel and van Flandern, published in the Communications of the ACM. An image of the core logic is here.

Modern Astronomy

A desire for an ultra-compact implementation is understandable for 1968. But is it still appropriate in the modern world? Fundamental astronomy has made giant strides in the past decades:

  • measurements of stellar positions, proper motions, and radial velocities from instruments such as GAIA are remarkably precise
  • modern models of the Earth's precession and nutation provide accurate results stretching back tens of thousands of years

Perhaps it's time to update the Julian date algorithm, and drop the restriction on dates.

A Confusion of Julians

There are two separate ideas, but their names are (unfortunately) nearly the same:

  • a Julian calendar is a calendar like our present-day Gregorian calendar, but with slightly different rules
  • the Julian date is number of days since a specific day in the distant past (which can be identified using different calendars)
  • a Julian date is not married to the Julian calendar (they never even dated, if you'll pardon the pun)

Fun fact: they are named after two different Julians!

A second point of confusion is the idea that Julian dates are defined using a specific timescale, such as UT1. That's not true.

Releases

No releases published

Packages

No packages published