API Reference / julianDay · function

Function: julianDay()

function julianDay(
   y, 
   mo, 
   d, 
   h?, 
   mi?, 
   s?): number;

Convert a UT calendar date and time to a Julian Day (UT) — the time coordinate the engine consumes. Pass the result to Engine.position, Engine.longitude, Engine.chartAt, and the event/derived functions; Engine.chart takes the calendar fields directly instead.

Arguments are UT, not local civil time — convert a local time to UT first (see the caelus-birth package). Uses the proleptic Gregorian calendar.

Parameters

ParameterTypeDefault valueDescription
ynumberundefinedYear in UT, e.g. 1990.
monumberundefinedMonth, 112.
dnumberundefinedDay of month, 131.
hnumber0Hour, 023. Defaults to 0.
minumber0Minute, 059. Defaults to 0.
snumber0Second, 059. Defaults to 0.

Returns

number

The Julian Day in UT (a fractional day count).

Example

const jd = julianDay(2025, 6, 1, 12, 0, 0); // 2025-06-01 12:00 UT
engine.longitude("sun", jd);

Start building

Quickstart →