Temporal.PlainDateTime.prototype.month
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 month
Accessor-Eigenschaft von Temporal.PlainDateTime
Instanzen gibt eine positive ganze Zahl zurück, die den Monat im Jahr dieses Datums als 1-basierten Index repräsentiert. Der erste Monat dieses Jahres ist 1
, und der letzte Monat ist der monthsInYear
. Es ist kalenderabhängig (calendar).
Der Set-Accessor von month
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 mehr Beispiele, siehe Temporal.PlainDate.prototype.month
.
Beispiele
Verwendung von month
const dt = Temporal.PlainDateTime.from("2021-07-01"); // ISO 8601 calendar
console.log(dt.monthCode); // "M07"
console.log(dt.month); // 7
Spezifikationen
Specification |
---|
Temporal # sec-get-temporal.plaindatetime.prototype.month |
Browser-Kompatibilität
Siehe auch
Temporal.PlainDateTime
Temporal.PlainDateTime.prototype.with()
Temporal.PlainDateTime.prototype.add()
Temporal.PlainDateTime.prototype.subtract()
Temporal.PlainDateTime.prototype.year
Temporal.PlainDateTime.prototype.day
Temporal.PlainDateTime.prototype.monthCode
Temporal.PlainDateTime.prototype.daysInMonth
Temporal.PlainDateTime.prototype.monthsInYear
Temporal.PlainDate.prototype.month