Julian Day Number, JD and MJD
Calendar arithmetic is surprisingly awkward: calculating the number of days between two dates requires tracking months of different lengths, leap years, and calendar reforms. Astronomers solved this centuries ago by mapping every date to a single integer counted continuously from an agreed epoch. That integer is the Julian Day Number (JDN).
This tool converts a Gregorian calendar date (and an optional UTC time) into its Julian Day Number (JDN), the full Julian Date (JD) that includes a fractional day, and the Modified Julian Date (MJD) used in modern astronomy and satellite tracking.
The three quantities
| Quantity | Definition | When day changes |
|---|---|---|
| JDN | Whole days since noon UTC, 1 Jan 4713 BC | Noon UTC |
| JD | JDN + fractional day from noon | Noon UTC |
| MJD | JD − 2,400,000.5 | Midnight UTC |
The MJD was introduced in the 1950s to produce smaller, more convenient numbers for modern dates and to shift the day boundary from noon to midnight, matching everyday timekeeping.
How the calculation works
The JDN is computed with the standard proleptic Gregorian algorithm. For a date
with day d, month m, and year y:
a = ⌊(14 − m) / 12⌋
y' = y + 4800 − a
m' = m + 12a − 3
JDN = d + ⌊(153·m' + 2) / 5⌋ + 365·y' + ⌊y'/4⌋ − ⌊y'/100⌋ + ⌊y'/400⌋ − 32045
The fractional day (for the full JD) is measured from noon UTC:
fraction = (hour − 12) / 24 + minute / 1440
so JD increments exactly at noon UTC, not midnight. The Modified Julian Date then subtracts the constant offset: MJD = JD − 2,400,000.5, which shifts the zero point to midnight.
Worked examples
J2000.0 (the standard astronomical epoch): 2000-01-01 at 12:00 UTC gives JDN = 2451545, JD = 2451545.0 (noon, so fraction is zero), and MJD = 51544.5. This epoch is used as the reference point for modern star catalogs and spacecraft ephemerides.
Date difference: The JDN for 2024-03-01 minus the JDN for 2024-01-01 is exactly 60 — the number of days between those dates, computed with simple subtraction, no month logic required. This is the primary reason JDNs exist.
Historical date: 1582-10-15, the first day of the Gregorian calendar, has JDN = 2299161. The day before — the last Julian-calendar date — is JDN = 2299160. The Julian Day count runs continuously through the reform with no gap.
When this comes up
- Astronomy and ephemeris calculations — orbital mechanics use JD as the standard time variable because it is a single real number without calendar discontinuities.
- Database date storage — some systems store dates as Julian Day integers for fast subtraction and comparison (SQLite, for example, uses a Julian Day real for its date functions).
- GPS and satellite tracking — GPS time is expressed as a week number and seconds of week, which converts cleanly through JD.
- Historical research — comparing dates across calendar reforms (Julian vs Gregorian) requires a common timeline; JDN provides it.
All calculations run in your browser; no data is sent to a server.