Skip to content

Documentation / @interstellar-tools/temporal / julianDate

Function: julianDate() ​

ts
function julianDate(date: Date, scale?: TimeScaleType): number;

Defined in: time-scales.ts:169

The Julian date of a moment, in a time scale: the number of days since noon on 1 January 4713 BC, counted on that scale's clock.

JD=tUnix+Δ86400000+2440587.5

Where:

  • tUnix is the Date's milliseconds since 1970-01-01T00:00:00Z (ms)
  • Δ is the scale's lead over UTC: 0 for UTC and UT1, TAI − UTC for TAI, TAI − UTC − 19 s for GPS, TAI − UTC + 32.184 s for TT, and that plus TDB − TT for TDB (ms)

Notes

  • UT1 is taken as UTC. They differ by up to 0.9 s; the exact difference is measured and published by the IERS, and the library fetches nothing.
  • TDB − TT comes from the series in USNO Circular 179 (eq. 2.6), good to 10 µs: within 1.7 ms, largest in early April and early October.
  • A Julian date as a double is precise to about 40 µs today.
  • UTC Julian dates step over leap seconds, like the Date itself: the difference between two of them in days can be 1 s short. Take differences in TAI or TT.

Parameters ​

ParameterTypeDefault valueDescription
dateDateundefinedThe moment, as a UTC Date (on or after 1972-01-01 for TAI, TT, TDB and GPS).
scale?TimeScaleType'UTC'The time scale to count in. Defaults to UTC.

Returns ​

number

The Julian date in days.

Throws ​

  • If date is not a valid Date.
  • If scale is not a TimeScaleType, or date is before 1972-01-01 for TAI, TT, TDB and GPS.

Example ​

ts
import { J2000_UTC } from '@interstellar-tools/constants';

julianDate(J2000_UTC, 'TT'); // 2451545: J2000 is JD 2451545.0 TT
julianDate(J2000_UTC); // 2451544.999257: 64.184 s earlier on the UTC clock
julianDate(J2000_UTC, 'GPS'); // 2451544.999408: 13 s ahead of UTC in 2000

See ​

https://aa.usno.navy.mil/publications/Circular_179 USNO Circular 179, for TDB