For developers

Julian Dates in Code

Copy-paste formulas and functions for both kinds of Julian date — the day-of-year code and the astronomical Julian Date — in the tools you actually use. Each snippet is verified against known reference values.

Two conversions, everywhere

Every page covers the same two tasks in its language:

  • Day-of-year (ordinal) Julian date — turn a date into YYYYDDD/YYDDD and back.
  • Astronomical Julian Date — turn a date/time into JD and MJD and back.

Prefer not to write any code? The on-site converter does both instantly in your browser.

A note on accuracy

The astronomical snippets use the standard algorithm from Jean Meeus and agree on the key anchors: the Unix epoch (JD 2440587.5), the MJD epoch (JD 2400000.5) and J2000.0 (JD 2451545.0). Watch out for time-zone and day-boundary details — the pages flag the common traps in each language.