
- MomentJS 教程
- MomentJS - 主頁
- MomentJS - 概覽
- MomentJS - 環境設定
- MomentJS - 簡介
- MomentJS - 解析日期和時間
- MomentJS - 日期驗證
- MomentJS - 獲取器/設定器
- 操作日期和時間
- 格式化日期和時間
- MomentJS - 日期查詢
- MomentJS - 國際化
- MomentJS - 自定義
- MomentJS - 持續時間
- MomentJS - 工具
- MomentJS - 外掛
- MomentJS - 示例
- MomentJS 有用資源
- MomentJS - 快速指南
- MomentJS - 有用資源
- MomentJS - 討論
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');
輸出

momentjs_durations.htm
廣告