JavaScript Temporal Instant
Working with Exact Time
A Temporal.Instant represents an exact moment in time.
It is similar to a timestamp and is always stored in UTC.
Learn how to use JavaScript Temporal.Instant to work with exact moments in time.
Compare Instants, convert from timestamps, and replace Date.now().
Note
Temporal is the modern way to work with dates and times in JavaScript.
Create an Instant
An Instant represents an exact moment in UTC time.
You can create an Instant from the current time:
This returns the exact current moment in UTC.
Create an Instant from a String
You can also create an Instant from an ISO 8601 string.
The Z at the end means UTC time.
Create an Instant from Epoch Milliseconds
You can create an Instant from a Unix timestamp (milliseconds since 1970-01-01).
This is similar to how Date works internally.
Replace Date.now()
With Date, you often use Date.now() to get the current timestamp.
Date Example
let timestamp = Date.now();
console.log(timestamp);
With Temporal, you can use:
Temporal Example
let instant = Temporal.Now.instant();
console.log(instant.epochMilliseconds);
The property epochMilliseconds returns the timestamp value.
Compare Instants
Instants can be compared directly.
Example
let a = Temporal.Instant.from("2026-02-17T12:00:00Z");
let b = Temporal.Instant.from("2026-02-18T12:00:00Z");
console.log(a < b);
This works because both values represent exact UTC moments.
Convert Instant to Date and Time
An Instant does not include time zone information.
You must convert it to a ZonedDateTime to display local time.
Example
let instant = Temporal.Now.instant();
let zoned = instant.toZonedDateTimeISO("Europe/Oslo");
console.log(zoned);
This converts the UTC moment to a specific time zone.
When to Use Instant
When storing timestamps in a database.
When comparing exact moments in time.
When working with logs or events.
When you need a UTC-based value.
Use Instant when you care about the exact moment, not how it looks in a time zone.
Summary
Temporal.Instant represents an exact UTC moment in time.
It replaces timestamp usage with Date and provides clearer and safer comparisons.