javascript instance method
Temporal.ZonedDateTime.prototype.toInstant()
The toInstant() method of ZonedDateTime instances returns a new Instant object representing the instant of this date-time.
Syntax
toInstant()
Parameters
None.
Return value
A new Instant object representing the instant of this date-time.
Examples
Using toInstant()
const zdt = Temporal.ZonedDateTime.from(
"2021-07-01T12:34:56.987654321-04:00[America/New_York]",
);
const instant = zdt.toInstant();
console.log(instant.toString()); // 2021-07-01T16:34:56.987654321Z
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.