
- MomentJS 教程
- MomentJS - 主頁
- MomentJS - 概述
- MomentJS - 環境設定
- MomentJS - 簡介
- MomentJS - 解析日期和時間
- MomentJS - 日期驗證
- MomentJS - 讀取器/設定器
- 操作日期和時間
- 格式化日期和時間
- MomentJS - 日期查詢
- MomentJS - 國際化
- MomentJS - 定製
- MomentJS - 時段
- MomentJS - 實用工具
- MomentJS - 外掛
- MomentJS - 示例
- MomentJS 實用資源
- MomentJS - 快速指南
- MomentJS - 實用資源
- MomentJS - 討論
MomentJS - 毫秒
此方法將提供時段內的毫秒數。它將在 0-999 範圍內顯示值。如果值大於 999,它將顯示為 0。要獲取毫秒為單位的持續時間長度,請使用asMilliseconds()方法。
語法
moment.duration().milliseconds(); moment.duration().asMilliseconds();
示例
var a = moment.duration(500).milliseconds();
輸出

示例
var a = moment.duration(1000).milliseconds();
輸出

示例
透過asMilliseconds,你將能夠獲取以毫秒為單位的值,如下所示
var a = moment.duration(1000).asMilliseconds();
輸出

momentjs_durations.htm
廣告