Temporal.ZonedDateTime.prototype.toInstant()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
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
toInstant()
Parameter
Keine.
Rückgabewert
Ein neues Temporal.Instant
Objekt, das den Zeitpunkt dieses Datums und dieser Uhrzeit darstellt.
Beispiele
Nutzung von 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
Spezifikationen
Specification |
---|
Temporal proposal # sec-temporal.zoneddatetime.prototype.toinstant |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
toInstant |
Legend
Tip: you can click/tap on a cell for more information.
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- User must explicitly enable this feature.