Changing Time Source2.11.0+

  1. 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:

  1. moment.now = function () {
  2. return +new Date();
  3. }

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.