Temporal.PlainDateTime.prototype.year
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 year
Zugriffseigenschaft von Temporal.PlainDateTime
Instanzen gibt eine Ganzzahl zurück, die die Anzahl der Jahre dieses Datums relativ zum Beginn eines kalenderspezifischen Epoche-Jahres darstellt. Es ist kalender--abhängig.
Der setzbare Accessor von year
ist undefined
. Sie können diese Eigenschaft nicht direkt ändern. Verwenden Sie die with()
Methode, um ein neues Temporal.PlainDateTime
Objekt mit dem gewünschten neuen Wert zu erstellen.
Für allgemeine Informationen und weitere Beispiele siehe Temporal.PlainDate.prototype.year
.
Beispiele
>Verwendung von year
const dt = Temporal.PlainDateTime.from("2021-07-01"); // ISO 8601 calendar
console.log(dt.year); // 2021
Spezifikationen
Specification |
---|
Temporal> # sec-get-temporal.plaindatetime.prototype.year> |
Browser-Kompatibilität
Loading…
Siehe auch
Temporal.PlainDateTime
Temporal.PlainDateTime.prototype.with()
Temporal.PlainDateTime.prototype.add()
Temporal.PlainDateTime.prototype.subtract()
Temporal.PlainDateTime.prototype.era
Temporal.PlainDateTime.prototype.eraYear
Temporal.PlainDateTime.prototype.yearOfWeek
Temporal.PlainDateTime.prototype.month
Temporal.PlainDateTime.prototype.day
Temporal.PlainDate.prototype.year