- MomentJS Tutorial
- MomentJS - Home
- MomentJS - Overview
- MomentJS - Environment Setup
- MomentJS - Introduction
- MomentJS - Parsing Date And Time
- MomentJS - Date Validation
- MomentJS - Getter/Setter
- Manipulate Date And Time
- Formatting Date And Time
- MomentJS - Date Queries
- MomentJS - Internationalization
- MomentJS - Customization
- MomentJS - Durations
- MomentJS - Utilities
- MomentJS - Plugins
- MomentJS - Examples
- MomentJS Useful Resources
- MomentJS - Quick Guide
- MomentJS - Useful Resources
- MomentJS - Discussion
MomentJS - Milliseconds
This method will give no of milliseconds in a duration. It will show the value in the range 0-999. If the value is greater than 999, it will display as 0. To get the length of duration in milliseconds, use asMilliseconds() method.
Syntax
moment.duration().milliseconds(); moment.duration().asMilliseconds();
Example
var a = moment.duration(500).milliseconds();
Output
Example
var a = moment.duration(1000).milliseconds();
Output
Example
With asMilliseconds, you will be able to get the value in milliseconds as shown below
var a = moment.duration(1000).asMilliseconds();
Output
momentjs_durations.htm
Advertisements