# Julian Day ⇄ calendar date converter

> Astronomy code counts time in Julian Days: a continuous day number that starts at noon UT. Convert in either direction with the exact arithmetic the astrology engine uses, verified against Swiss Ephemeris.

Source: https://astronode.dev/tools/julian-day-converter · Updated: 2026-12-01

The interactive tool runs in the browser at https://astronode.dev/tools/julian-day-converter; this file is its explanation.

## What a Julian Day is

A Julian Day (JD) is the number of days since noon UT on 1 January 4713 BC in the proleptic Julian calendar, with the time of day as a fraction. Because it is one real number with no months, leap years or time zones, it is what ephemeris code - Swiss Ephemeris included - takes as its time argument. Note the noon start: JD `2451545.0` is 2000-01-01 **12:00** UT (the J2000 epoch), and midnight that morning is `2451544.5`.

*Reference points*

| Moment (UT) | Julian Day |
| --- | --- |
| 2000-01-01 12:00 (J2000) | `2451545.0` |
| 1970-01-01 00:00 (Unix epoch) | `2440587.5` |
| 1900-01-01 00:00 | `2415020.5` |
| 1973-04-24 17:25 IST = 11:55 UT | `2441796.996528` |

## How it is computed

The forward direction is Swiss Ephemeris `swe_julday` with the Gregorian flag: shift January and February to the end of the previous year, then `JD = floor(365.25 × (Y + 4712)) + floor(30.6 × (M + 1) + 0.000001) + D + hour/24 - 63.5`, minus the Gregorian century correction `floor(Y/100) - floor(Y/400) - 2`. The reverse is `swe_revjul`. Both are ported to TypeScript here and checked against the engine for 45 moments between 1900 and 2100: the difference is zero.

The engine calls this for every chart. It first converts your local `time` to a decimal UT hour with `tz_offset_minutes` (rolling the date if needed), then calls `julday(year, month, day, hourUt)` - so the JD it computes from is a **UT** Julian Day. The left-hand side of this tool does the same two steps.

> **Note:** The engine always uses the Gregorian calendar, extended backwards (proleptic). For a date before a country adopted the Gregorian calendar, convert the historical (Julian-calendar) date first; sending it as-is gives a day count up to 13 days off.

## Where you meet Julian Days in the API

Requests never take a JD - they take `date`, `time` and `tz_offset_minutes`. A few responses return one, all as UT Julian Days: `return_jd` from the [solar return chart](https://astronode.dev/capabilities/western/western-solar-return-chart) (next to `return_utc`, the same instant as ISO-8601), `solar_return.return_jd` from the [Varshphal year chart](https://astronode.dev/capabilities/vedic/varshphal-year-chart), and `anchor_jd` on each upagraha from [upagraha positions](https://astronode.dev/capabilities/vedic/upagraha-positions). A recorded solar-return response carried `return_jd: 2460860.396737061`, which converts to **2025-07-03 21:31:18 UT**.

## Common mistakes

- **Forgetting the noon start.** Taking the integer part of a JD as "the date" is wrong for every time before noon UT. Use the converter, or add 0.5 before flooring.
- **Mixing UT and TT.** Swiss Ephemeris functions with a `_ut` suffix take UT Julian Days; the bare versions take Terrestrial Time, about 69 seconds ahead today. The engine computes UT Julian Days and calls the `_ut` versions.
- **Feeding local time.** A JD is always UT. Convert the local time with the birth's offset first - the left-hand form does it.
- **Floating-point display.** A double carries a JD to roughly 0.00005 s; printing six decimals (0.09 s) is plenty. Do not compare JDs for exact equality.

## FAQ

**What is the Modified Julian Date?**

MJD = JD - 2400000.5. It starts at midnight instead of noon and keeps the numbers smaller; it is common in satellite and data-pipeline code.

**How do I get a JD from a Unix timestamp?**

JD = unix_seconds / 86400 + 2440587.5. Unix time ignores leap seconds, as UT-based JDs effectively do for this purpose.

**Does the API round times?**

Times the engine prints from a JD (sunrise, sunset and similar) are rounded to whole seconds when converted back to a date.

## Related endpoints

- [`POST /v1/western/solar-return/chart`](https://astronode.dev/capabilities/western/western-solar-return-chart) - Solar Return Chart API
- [`POST /v1/varshphal/year-chart`](https://astronode.dev/capabilities/vedic/varshphal-year-chart) - Varshphal Annual Chart (Tajika) API
- [`POST /v1/upagraha-positions`](https://astronode.dev/capabilities/vedic/upagraha-positions) - Upagraha Positions (Gulika, Mandi) API
