Milliseconds1.6.0+

  1. moment.duration().milliseconds();
  2. moment.duration().asMilliseconds();

To get the number of milliseconds in a duration, use moment.duration().milliseconds().

It will return a number between 0 and 999.

  1. moment.duration(500).milliseconds(); // 500
  2. moment.duration(1500).milliseconds(); // 500
  3. moment.duration(15000).milliseconds(); // 0

If you want the length of the duration in milliseconds, use moment.duration().asMilliseconds() instead.

  1. moment.duration(500).asMilliseconds(); // 500
  2. moment.duration(1500).asMilliseconds(); // 1500
  3. moment.duration(15000).asMilliseconds(); // 15000