# `Instant`

One moment for everyone, written `2026-10-25T09:30:00Z`.

[Time and calendar](types.md#time-and-calendar); ordered; since Jadpo 0.1.0.

## Make one

`text.parse(raw, as: Instant)` reads one from its text; text that isn't one at all fails `malformed`, such as `2026-10-25`, `2026-10-25T09:30:00` or `yesterday`.

This operation gives one: `temporal.instant`.

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends its canonical text as a string.

| Text | JSON |
|---|---|
| `2026-03-29T00:30:00Z` | `"2026-03-29T00:30:00Z"` |
| `2026-10-25T09:30:00.250Z` | `"2026-10-25T09:30:00.250Z"` |

It is stored in one column named for the field, of type `timestamptz(3)`. `2026-10-25T09:30:00.250Z` is stored as `'2026-10-25 09:30:00.250000+00'::timestamptz`.

## Shown to people

`text.format(value, locale:)` shows it to people in their locale. A call also gives `zone:` and `format:`.

With `locale: Locale.en_gb`, `zone: Zone.europe_london` and `format: TimeFormat.date_time_medium`:

| Value | Shown |
|---|---|
| `2026-03-29T00:30:00Z` | `29 Mar 2026, 00:30:00` |
| `2026-10-25T09:30:00.250Z` | `25 Oct 2026, 09:30:00` |

## Operations

- `temporal.between(start: Instant, end: Instant) -> Duration`: How long from `start` to `end`: `end - start`.
- `temporal.format_relative(value: T, now: Instant, zone: Zone?, locale: Locale) -> PresentationText`: `value` shown to a person in `locale` as how long ago it was from `now`: "just now", minutes, "Today at", "Yesterday at", the weekday, then the long date.
- `temporal.in_zone(instant: Instant, zone: Zone) -> ZonedTime`: `instant` as the local time in `zone`.
- `temporal.instant(value: ZonedTime) -> Instant`: The instant a local time is.
- `temporal.occurrences(rule: RecurrenceRule, from: T, count: Int) -> List<ZonedTime>`: The next `count` occurrences of `rule` at or after `from`, in its zone (RFC 5545): fewer when the rule ends first; `count` is from 1 to 1000, so an unbounded rule is never expanded without a bound. From a date, the days they fall on, `List<CalendarDate>`, which a rule on dates gives; from an `Instant`, a timed rule's local times.
- `temporal.open_at(hours: OpeningHours, at: Instant) -> Bool`: Whether `hours` are open at `at`, by the clock in their zone.

Like every standard type, it also has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It is ordered, so `<` and sorting take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
