TLEs – Calculation of the Julian Day Number (JDN)

This post is part of a series on understanding the meaning behind the values contained in a Two Line Element set, or Keplerian Elements. The main article is here.

Calculation of the Julian Day Number (JDN)

Julian day numbers are regularly used in astronomy instead of a date.

Julian day numbers are simply the count of days that have elapse since noon on January 1, 4713 BC Greenwich time using the Julian proleptic calendar.

We generally use the Gregorian calendar. Calculation to a Julian date is a little cryptic as the two calendars have different rules for calculating leap years.

    Julian Calendar

  • Every 4 years
    Gregorian Calendar

  • Every 4 years except when the year is divisble by 100
  • But ALWAYS every 400 years

To calculate the value, we first get the Julian date of the year, then add on the days in the year followed by the fraction of the day.

Some astronomers like to use a Modified Julian Date. This is simply the Julian Date with 2,400,000.5 subtracted from it making the number smaller and based on midnight rather than noon UTC.

Here is some C# which will calculate the following:

  • Julian Day from a DateTime
  • Julian Day for a year
  • Julian Day from a Satellite Epoch
  • Converting between modified and standard Julian dates
double getJulianDay_DateTime(DateTime date)
    //Calculate the day of the year and the
    double dDay = date.DayOfYear;
    dDay += Convert.ToDouble(date.Hour) / 24;
    dDay += Convert.ToDouble(date.Minute) / 1440;
    dDay += Convert.ToDouble(date.Second) / 86400;
    return dDay + getJulianDay_Year(date.Year);
double getJulianDay_Year(int year)
    double dYear = year - 1;
    double A = Math.Floor(dYear / 100);
    double B = 2 - A + Math.Floor(A / 4);
    //The use of 30.600000000000001 is to correct for floating point rounding problems
    double dResult = Math.Floor(365.25 * dYear) + 1721422.9 + B;
    return dResult;
double getJulianDay_SatEpoch(int year, double dSatelliteEpoch)
    //Tidy up the year and put it into the correct century
    year = year % 100;
    if (year < 57) year += 2000;
    else year += 1900;
    double dResult = getJulianDay_Year(year);
    dResult += dSatelliteEpoch;
    return dResult;
double getModifiedJulian_Julian(double dJulian)
    return dJulian - 2400000.5;
double getJulian_ModifiedJulian(double dModifiedJulian)
    return dModifiedJulian + 2400000.5;

You May Also Like

About the Author: John


  1. I think you might have a typo in the following line?

    “double dResult = Math.Floor(365.25 * dYear) + 1721422.9 + B;”

    I believe that the number should be 1721422.5. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *