JavaScript setMinutes () method
Definition and Usage
setMinutes () method is used to set the minutes field specified time.
The same method is used to set the number of seconds and milliseconds.
Browser Support
All major browsers support setMinutes () method
grammar
Date.setMinutes( min , sec , millisec )
Parameter Value
参数 | 描述 |
---|---|
min | 必需。表示分钟的数值,
介于 0 ~ 59 之间,以本地时间计(下同):
|
sec | 可选。表示秒的数值,
介于 0 ~ 59 之间。在 EMCAScript 标准化之前,不支持该参数:
|
millisec | 可选。表示毫秒的数值
,介于 0 ~ 999 之间。在 EMCAScript 标准化之前,不支持该参数:
|
return value
Type | 描述 |
---|---|
Number | 返回1970年一月一日至调整过的日期的毫秒数。在 ECMAScript 标准化之前,该方法什么都不返回。 |
technical details
JavaScript version: | 1.0 |
---|
More examples
Examples
Setting the date of 90 minutes ago:
var d = new Date();
d.setMinutes(d.getMinutes()-90);
d.setMinutes(d.getMinutes()-90);
d output:
try it"