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