Temporal.ZonedDateTime.prototype.monthsInYear
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính accessor monthsInYear của các thực thể Temporal.ZonedDateTime trả về một số nguyên dương biểu thị số tháng trong năm của ngày này. Thuộc tính này phụ thuộc vào lịch.
Set accessor của monthsInYear là undefined. Bạn không thể thay đổi thuộc tính này trực tiếp.
Để biết thêm thông tin chung và các ví dụ khác, hãy xem Temporal.PlainDate.prototype.monthsInYear.
Ví dụ
>Sử dụng monthsInYear
js
const dt = Temporal.ZonedDateTime.from("2021-07-01[America/New_York]");
console.log(dt.monthsInYear); // 12
Đặc tả
| Specification |
|---|
| Temporal> # sec-get-temporal.zoneddatetime.prototype.monthsinyear> |
Tương thích trình duyệt
Xem thêm
Temporal.ZonedDateTimeTemporal.ZonedDateTime.prototype.with()Temporal.ZonedDateTime.prototype.add()Temporal.ZonedDateTime.prototype.subtract()Temporal.ZonedDateTime.prototype.yearTemporal.ZonedDateTime.prototype.monthTemporal.ZonedDateTime.prototype.monthCodeTemporal.ZonedDateTime.prototype.daysInMonthTemporal.PlainDate.prototype.monthsInYear