Temporal.ZonedDateTime.prototype.toInstant()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Die toInstant()-Methode von Temporal.ZonedDateTime-Instanzen gibt ein neues Temporal.Instant-Objekt zurück, das den Zeitpunkt dieses Datums und dieser Uhrzeit darstellt.
Syntax
js
toInstant()
Parameter
Keine.
Rückgabewert
Ein neues Temporal.Instant-Objekt, das den Zeitpunkt dieses Datums und dieser Uhrzeit darstellt.
Beispiele
>Verwendung von toInstant()
js
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
Spezifikationen
| Specification |
|---|
| Temporal> # sec-temporal.zoneddatetime.prototype.toinstant> |