# fromModifiedJulianDate

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
fromModifiedJulianDate(mjd: number, scale?: TimeScale): string
```

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

- The inverse of `toModifiedJulianDate`. The double is read exactly (`mjd − 40587` days since 1970-01-01), then rounded once to the nearest nanosecond, a half rounding up (Temporal's `halfExpand`).
- MJD = JD − 2 400 000.5 and counts from midnight, not noon: `51544` is midnight, `51544.5` noon.
- A double from `toModifiedJulianDate` is at most ½ ulp(MJD) days from the instant: 0.31 µs for 1972 to 2038-04-22, growing to 20.1 µs (2⁻³² day) by year 9999, as MJD stays below 2²². For nanoseconds use `fromJulianDateParts`.
- On `"UTC"` the count is ERFA's quasi-MJD: a day with a leap second counts as one day, so on a leap-second day the fraction 86400/86401 of the day is where `…T23:59:60Z` begins. On `"TAI"`, `"TT"` and `"TCG"` it is a true count. TDB is not available.
- Returns `"Z"` form with Temporal's shortest fraction, and `…:60` inside an inserted second.
- `mjd` must be a finite number; a bigint, a numeric string, `NaN` or `Infinity` gives "".
- Domain: 1972-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z UTC; "" outside it.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `mjd` | `number` | the Modified 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

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

## Examples

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

fromModifiedJulianDate(51544) // "2000-01-01T00:00:00Z"
```

## Source

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