JavaScript Ngày setMinutes()
Sự miêu tả
setMinutes()
đặt số phút của một ngày.
Phương pháp này cũng có thể được sử dụng để đặt giây và mili giây.
Ví dụ 2
Đặt thời gian ngày là 90 phút trước :
const d = new Date();
d.setMinutes(d.getMinutes() - 90);
Hãy tự mình thử »Hỗ trợ trình duyệt
setMinutes()
là tính năng ECMAScript1 (ES1).
ES1 (JavaScript 1997) được hỗ trợ đầy đủ trên tất cả các trình duyệt:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Date .setMinutes( min , sec , millisec )
Giá trị tham số
Parameter | Description |
---|---|
min | Required. An integer representing the minutes.
Expected values are 0-59, but other values are allowed:
|
sec | Optional. An integer representing the seconds
Expected values are 0-59, but other values are allowed:
|
millisec | Optional. An integer representing the milliseconds
Expected values are 0-999, but other values are allowed:
|
Chi tiết kỹ thuật
Giá trị trả về: | Một Số, biểu thị số mili giây giữa đối tượng ngày và nửa đêm ngày 1 tháng 1 năm 1970 |
---|---|
Phiên bản JavaScript: | ECMAScript 1 |