Date.prototype.setUTCSeconds()
此setUTCSeconds()
方法为一个依据国际通用时间的特定日期设置秒数。
语法
dateObj.setUTCSeconds(secondsValue[, msValue])
参数
secondsValue
- 一个在0到59之间的整数,表示秒数。
msValue
- 可选参数。一个0到999之间的数字,代表毫秒数。
返回值
一个毫秒数,表示从国际通用时间1970年00:00:00到设置的时间值之间的时间跨度。
描述
如果你没有设置msValue参数的值,那么返回的值来自getUTCMilliseconds()
方法。
如果你指定的值超出了范围,setUTCSeconds()
因此会更新Date
对象中的分钟数会增加1,并且秒数会变成40.
示例
使用setUTCSeconds()
var theBigDay = new Date(); theBigDay.setUTCSeconds(20);