# fromJulianDateParts

Industry: Core

:::caution[Unreleased]
Not in `@northguild/gmt` 1.21.0 on npm yet. It is on `main` and ships in the next release.
:::

## Signature

```ts
fromJulianDateParts(parts: JulianDateParts, scale?: TimeScale): string
```

Convert a two-part Julian Date on a time scale to a UTC instant string. The scale defaults to `"UTC"`.

- The inverse of `toJulianDateParts`. The two doubles are read exactly and summed exactly (`jd1 + jd2 − 2440587.5` days since 1970-01-01), then rounded to the nearest nanosecond, a half rounding up (Temporal's `halfExpand`). On `"UTC"`, `"TAI"` and `"TT"` that rounds the instant. On `"TCG"` it rounds the TCG label, which `fromTCG` then maps to UTC (flooring to the TT nanosecond), so the result can be 1 ns later than the exact inverse of the date. The round trip with `toJulianDateParts` stays exact.
- Any split works (ERFA `jd2cal.c` Note 2): `{2451545, 0}`, `{2400000.5, 51544.5}`, `{0, 2451545}` and `{2451545.5, -0.5}` give the same instant, though a split that puts everything into one part has already lost precision in that double.
- JD days begin at noon: `{ jd1: 2451544, jd2: 0.5 }` is midnight UTC.
- On `"UTC"` the count is ERFA's quasi-JD: a day with a leap second counts as one day, so a fraction past the end of an ordinary day reads as `…T23:59:60Z` on a leap-second day. On `"TAI"`, `"TT"` and `"TCG"` it is a true JD. TDB is not available.
- Returns `"Z"` form with Temporal's shortest fraction, and `…:60` inside an inserted second.
- Both members must be finite numbers; a bigint, a numeric string, `NaN` or a missing member gives "".
- Domain: 1972-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z UTC; "" outside it.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `parts` | `JulianDateParts` | the two-part Julian Date |
| `scale` | `TimeScale` | the time scale the date is counted on, default `"UTC"` |

## Returns

ISO 8601 UTC instant string (`Z`), or "" on invalid input, an unknown scale or a date outside the domain

## Related types

- [`JulianDateParts`](/gmt/reference/types/JulianDateParts/)
- [`TimeScale`](/gmt/reference/types/TimeScale/)

## Examples

```ts
import { fromJulianDateParts } from "@northguild/gmt/timescale/convert";

fromJulianDateParts({ jd1: 2451545, jd2: 0 }) // "2000-01-01T12:00:00Z"
```

## Source

[timescale/convert/fromJulianDateParts.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/timescale/convert/fromJulianDateParts.ts)
