Changing Time Source2.11.0+
moment.now = function () { return +new Date(); }
If you want to change the time that Moment sees, you can specify a method thatreturns the number of milliseconds since the Unix epoch (January 1, 1970).
The default is:
moment.now = function () {
return +new Date();
}
This will be used when calling moment()
, and the current date used when tokens are omitted fromformat()
. In general, any method that needs the current time uses this under the hood.
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .