What the Julian Day Number is for
The Julian Day Number, or JDN, is a single integer that counts whole days from a fixed origin far in the past. Because it is just a count, the number of days between two dates is a simple subtraction, which makes the JDN the backbone of astronomical timekeeping and many calendar routines. This tool converts a Gregorian date to its JDN and converts a JDN back to a date.
Why astronomers and software engineers use JDN
Calculating the number of days between two calendar dates using year/month/day fields is surprisingly fiddly: you must account for varying month lengths, leap years (including the Gregorian century-year rule), and the possibility of spanning year boundaries. Converting both dates to JDN first reduces the problem to a single integer subtraction.
JDN is also timezone-free and calendar-reform-free. Because it is a continuous count anchored far before any calendar reform, it works equally well for ancient dates, medieval dates, and modern dates without worrying about the Julian-to-Gregorian switch of 1582. Astronomers adopted it for exactly this reason in the 19th century.
Software uses cases include:
- Date arithmetic in systems that store dates as JDN integers rather than year/month/day
- Matching dates across historical calendar systems (Julian, Gregorian, Hebrew, Islamic) which all convert to and from JDN
- Verifying date parsing by comparing the JDN back to the expected calendar date
- Finding the day of the week for any date without a full calendar library
How it works
The conversion uses the algorithm published by Fliegel and Van Flandern in 1968, which computes the JDN with integer arithmetic and no lookup tables. Going from a date, it shifts the year and month so that the leap-day boundary falls at the end of the cycle, then sums the contributions of years, the leap-year corrections for the Gregorian rule, and the day of the month.
2000-01-01 → JDN 2451545
2024-02-29 → JDN 2460370
The reverse direction inverts the same arithmetic to recover the year, month, and day from the integer. After converting from a date, the tool also checks that the JDN maps back to the exact day entered, which rejects impossible dates such as the 30th of February.
Useful reference JDNs
Some anchor dates worth remembering:
| Date | JDN | Note |
|---|---|---|
| 1 Jan 2000 | 2451545 | J2000.0 epoch used in astronomy |
| 1 Jan 1970 | 2440588 | Unix epoch (days, not seconds) |
| 1 Jan 1900 | 2415021 | Common accounting and spreadsheet epoch |
| 15 Oct 1582 | 2299161 | First day of the Gregorian calendar |
| 1 Jan 4713 BC (proleptic Julian) | 0 | JDN origin |
The Unix timestamp in seconds equals (JDN − 2440588) × 86400 (for midnight UTC), which is how JDN bridges old and modern timestamp systems.
The proleptic Gregorian calendar and what it means for ancient dates
This tool uses the proleptic Gregorian calendar — meaning the Gregorian leap-year rules are applied backwards to dates before 1582. This matches what ISO 8601 requires and what most programming languages and databases use. It is not the same as the historical Julian calendar in use before 1582.
For modern dates (after 1582) the two calendars agree on the concept of a date but not always on the day count. If you are working with historical astronomical observations recorded in the Julian calendar, you need to convert from Julian calendar to Gregorian first before using this tool.
To enter a BC date, use the astronomical year number: 1 BC = year 0, 2 BC = year −1, 100 BC = year −99. The tool accepts negative years in the date field.
Example and notes
The reference date is 2000-01-01, JDN 2451545, a useful anchor to remember. The
weekday follows directly from the number: JDN 0 was a Monday, so the day of the week
is (JDN mod 7) mapped to Mon–Sun. All dates are interpreted in the proleptic Gregorian calendar, so results before 1582 follow the Gregorian rules rather than the historical Julian calendar.