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.
Excel
Formulas for day-of-year codes and JD — no macros needed.
Python
datetime, strftime %j, and a Meeus JD function (plus astropy).
JavaScript
UTC-safe day-of-year and the JD = ms/86400000 + 2440587.5 identity.
SQL
SQL Server, Oracle, PostgreSQL and MySQL — including Oracle’s J format.
SAS
JULDATE7, DATEJUL and the clean MJD = date + 36934 shortcut.
Java & C#
JulianFields built-ins on the JVM and DayOfYear on .NET.
Two conversions, everywhere
Every page covers the same two tasks in its language:
- Day-of-year (ordinal) Julian date — turn a date into
YYYYDDD/YYDDDand back. - Astronomical Julian Date — turn a date/time into
JDandMJDand 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.