MomentJS - 获取时间单位



这是对所有 **duration().hours(), duration().minutes()** 等等的替代方法。

语法

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

示例

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

输出

Units of Time
momentjs_durations.htm
广告
© . All rights reserved.