how to calculate the Julian Day Number (JDN) for any date
The Julian Day Number (JDN) is a continuous count of days used by astronomers, historians and software to convert between calendar dates and a single numeric timeline. Calculating the JDN lets you compare dates, compute intervals precisely and convert between calendar systems. Below you’ll find the formula, a clear step-by-step manual method, worked numeric examples and guidance on interpreting the result.
what is the Julian Day Number and why it matters
The JDN assigns an integer to each calendar day starting at noon UTC on the standard epoch (January 1, 4713 BCE in the Julian calendar = JDN 0). It avoids complications of months, leap years and calendar reforms, so differences between dates become simple subtractions. Use cases: astronomical event timing, date arithmetic across historical calendar changes, computer date conversions and precise interval calculations.
the algorithm (Fliegel–Van Flandern) — simple and reliable
This algorithm converts a Gregorian or Julian calendar date (year, month, day) into a Julian Day Number. It works for proleptic Gregorian dates (extending Gregorian rules backward) and for strictly Julian calendar dates if you adjust the input calendar flag. The steps below assume the Gregorian calendar unless stated otherwise.
formula and integer steps
Given a date: year = Y, month = M, day = D (D can include fractional day if you need time of day), follow these integer operations:
- If M <= 2 then set Y' = Y - 1 and M' = M + 12; otherwise Y' = Y and M' = M.
- A = floor(Y' / 100)
- B = 2 - A + floor(A / 4) (for Gregorian calendar). For the Julian calendar set B = 0.
- JDN = floor(365.25 * (Y' + 4716)) + floor(30.6001 * (M' + 1)) + D + B - 1524
Notes:
- Use integer floor operations where shown. Many implementations cast to integer after the multiplication.
- If D includes a fractional part (time of day), the JDN will be fractional; JDN integers start at noon UTC. To use midnight-based day numbering, convert appropriately (see interpretation).
step-by-step manual calculation (example: 2026-10-17)
We’ll compute the JDN for 2026-10-17 (Gregorian calendar). Set Y=2026, M=10, D=17.
- M > 2 so Y' = 2026, M' = 10.
- A = floor(2026 / 100) = 20.
- B = 2 - A + floor(A / 4) = 2 - 20 + floor(20 / 4) = 2 - 20 + 5 = -13.
- floor(365.25 * (Y' + 4716)) = floor(365.25 * 6742) = floor(2,463,160.5) = 2,463,160.
- floor(30.6001 * (M' + 1)) = floor(30.6001 * 11) = floor(336.6011) = 336.
- JDN = 2,463,160 + 336 + 17 + (-13) - 1524 = 2,461, - wait, compute precisely: 2,463,160 + 336 = 2,463,496. Add 17 -> 2,463,513. Add B (-13) -> 2,463,500. Subtract 1524 -> 2,461,976.
Final JDN for 2026-10-17 (noon UTC basis) = 2461976.
worked example with time (fractional day)
To include a time of day, add the day fraction to D. For example: 2026-10-17 at 03:30 UTC. Convert time to fraction of a day: 3.5 hours / 24 = 0.145833333.
Use D = 17.145833333. Repeat the algorithm steps (A and B are the same). The integer parts of the large multiplications are unchanged; only the +D term changes:
JDN = 2,463,160 + 336 + 17.145833333 - 13 - 1524 = 2461976.145833333.
That fractional JDN represents the precise timestamp on the Julian Day scale (still referenced to noon UTC baseline).
converting between JDN and calendar date (outline)
Reversing JDN to a calendar date requires the inverse algorithm (also well established). The general inverse steps are:
- Start with J = JDN + 0.5 (to switch from noon-based JDN to midnight-based calculation), then separate integer and fractional parts.
- Use integer arithmetic to recover year, month and day (accounting for Gregorian correction B).
Online calculators on sites like Calculatorr perform this conversion instantly and avoid manual rounding errors.
interpretation: what the JDN value means
- JDN is a serial day count referenced to a historical epoch; higher numbers are later dates.
- The integer JDN corresponds to the day that begins at noon UTC. For everyday date arithmetic you may prefer the Modified Julian Day (MJD) or to shift by 0.5 to use midnight-based numbering.
- Subtracting two JDNs gives the exact number of days (including fractions) between timestamps without worrying about months or leap years.
common pitfalls and how to avoid them
- Calendar type confusion: ensure you know whether the input date uses the Gregorian or Julian calendar. Use B = 0 for Julian dates before a region adopted the Gregorian system.
- Noon vs midnight: the traditional JDN rolls at noon UTC. If you expect midnight-based days, add or subtract 0.5 as needed.
- Rounding errors: apply floor (integer) operations exactly as specified. Using floating-point rounding instead of floor can produce off-by-one errors.
- Historical dates: dates prior to 1582 require careful handling because different regions adopted the Gregorian calendar at different times. For historical research, document which calendar you assume or use proleptic Gregorian consistently.
quick checks to validate your result
- Known anchor: JDN 2451545 = 2000-01-01.5 (noon on 2000-01-01). Use this as a sanity check for computations near that epoch.
- Round-trip test: convert date -> JDN -> date using a trusted converter (for example tools on Calculatorr). The recovered date and time should match the original.
when to use JDN vs alternatives
- Use JDN for astronomy, long-range date arithmetic and systems that must operate across calendar reforms.
- Use Modified Julian Day (MJD = JDN - 2400000.5) when working with current astronomical databases that prefer a smaller number and midnight-based days.
- For everyday scheduling and local time calculations, standard calendar libraries (ISO dates, Unix timestamps) may be more convenient and timezone-aware.
how to use an online JDN calculator
To avoid manual steps, enter year, month, day and (optionally) time into an online Julian Day calculator. A good calculator will:
- Let you select Gregorian or Julian calendar mode.
- Accept fractional day or time-of-day fields and return fractional JDN.
- Provide inverse conversion (JDN back to calendar date) and explain whether JDN uses noon or midnight origin.
Try the date conversion tools at Calculatorr for immediate, accurate results and to check manual calculations quickly.
summary of steps (compact)
- Adjust year and month: if month <= 2, subtract 1 from year and add 12 to month.
- Compute A = floor(Y'/100) and B = 2 - A + floor(A/4) for Gregorian (B = 0 for Julian).
- Compute JDN = floor(365.25*(Y'+4716)) + floor(30.6001*(M'+1)) + D + B - 1524.
- Include fractional day in D to capture time of day; remember the noon-based origin.
With these rules you can compute the Julian Day Number for any date reliably and use it for precise interval calculations, astronomical timing or historical date conversions.