Temporal.ZonedDateTime.prototype.dayOfWeek
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 dayOfWeek của các instance Temporal.ZonedDateTime trả về một số nguyên dương biểu diễn chỉ số ngày dựa trên 1 trong tuần của ngày này. Các ngày trong tuần được đánh số tuần tự từ 1 đến daysInWeek, với mỗi số tương ứng với tên của nó. Giá trị này phụ thuộc vào calendar.
Set accessor của dayOfWeek là undefined. Bạn không thể thay đổi thuộc tính này trực tiếp. Để tạo một đối tượng Temporal.ZonedDateTime mới với giá trị dayOfWeek mong muốn, hãy dùng phương thức add() hoặc subtract() với số lượng days phù hợp.
Để biết thêm thông tin chung và ví dụ, hãy xem Temporal.PlainDate.prototype.dayOfWeek.
Ví dụ
>Sử dụng dayOfWeek
js
const dt = Temporal.ZonedDateTime.from("2021-07-01[America/New_York]");
console.log(dt.dayOfWeek); // 4; Thursday
Đặc tả kỹ thuật
| Specification |
|---|
| Temporal> # sec-get-temporal.zoneddatetime.prototype.dayofweek> |
Khả năng tương thích với trình duyệt
Xem thêm
Temporal.ZonedDateTimeTemporal.ZonedDateTime.prototype.with()Temporal.ZonedDateTime.prototype.add()Temporal.ZonedDateTime.prototype.subtract()Temporal.ZonedDateTime.prototype.dayTemporal.ZonedDateTime.prototype.dayOfYearTemporal.ZonedDateTime.prototype.daysInWeekTemporal.ZonedDateTime.prototype.weekOfYearTemporal.ZonedDateTime.prototype.yearOfWeekTemporal.PlainDate.prototype.dayOfWeek