MomentJS - Get Unit of Time



This is an alternative method for all duration().hours(), duration().minutes() etc.

Syntax

duration.get('hours');
duration.get('minutes');
duration.get('seconds');
duration.get('milliseconds');

Example

var d = moment.duration(500, 'hours').get('hours');

Output

Units of Time
momentjs_durations.htm
Advertisements