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
| Parameter | Type | Default value | Description |
|---|---|---|---|
y | number | undefined | Year in UT, e.g. 1990. |
mo | number | undefined | Month, 1–12. |
d | number | undefined | Day of month, 1–31. |
h | number | 0 | Hour, 0–23. Defaults to 0. |
mi | number | 0 | Minute, 0–59. Defaults to 0. |
s | number | 0 | Second, 0–59. 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);