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
廣告