• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • Date.prototype.setMilliseconds()

    setMilliseconds()方法会根据本地时间设置一个日期对象的豪秒数。

    语法

    dateObj.setMilliseconds(millisecondsValue)
    

    参数

    millisecondsValue
    一个 0 到 999 的数字,表示豪秒数。

    描述

    如果指定的数字超出了合理范围,则日期对象的时间信息会被相应地更新。例如,如果指定了 1005,则秒数加 1,豪秒数为 5。

    例子

    例子:使用setMilliseconds

    var theBigDay = new Date();
    theBigDay.setMilliseconds(100);