Method Deck / dates

Julian Day Number of a civil date

Converts a proleptic Gregorian civil date to its Julian Day Number (JDN).

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. Parse the date as a proleptic Gregorian civil date.
  2. Convert it to a day-number using Hinnant's days_from_civil algorithm, which is arithmetically equivalent to the Fliegel and Van Flandern (1968) integer JDN formula.
  3. Add 2440588 (the JDN of 1970-01-01, the algorithm's epoch) to obtain the Julian Day Number.

Constants

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"date":"2000-01-01"}2451545
test vector: Unix epoch{"date":"1970-01-01"}2440588
test vector: recent date{"date":"2024-01-01"}2460311

Published card