- MomentJS 教程
- MomentJS - 主頁
- MomentJS - 概述
- MomentJS - 環境設定
- MomentJS - 簡介
- MomentJS - 時間解析
- MomentJS - 日期驗證
- MomentJS - 獲取器/設定器
- 操縱日期和時間
- 時間格式化
- MomentJS - 日期查詢
- MomentJS - 國際化
- MomentJS - 自定義
- MomentJS - 時間間隔
- MomentJS - 實用程式
- MomentJS - 外掛
- MomentJS - 示例
- MomentJS 有用資源
- MomentJS - 快速指南
- MomentJS - 有用資源
- MomentJS - 討論
MomentJS - 作為 ISO 8601 字串
此方法將時間間隔返回為 ISO 8601 字串。
語法
moment.duration().toISOString();
示例
var d = moment.duration(2, 'weeks').toISOString();
輸出
請注意,上述輸出中顯示的 P 表示時間段。
此處給出的表格顯示格式 PnYnMnDTnHnMnS 說明 -
| 序號 | 單位和說明 |
|---|---|
| 1 | P P 代表時間段。置於時間間隔表示的開頭。 |
| 2 | Y 年 |
| 3 | M 月 |
| 4 | D 日 |
| 5 | T 時間成分前面的指示符。 |
| 6 | H 小時 |
| 7 | M 分 |
| 8 | S 秒 |
momentjs_durations.htm
廣告