toISOString()


moment.duration().toISOString();

返回 ISO 8601 标准指定的字符串形式的时长。

moment.duration(1, 'd').toISOString() // "P1D"

格式 PnYnMnDTnHnMnS 的说明:

单位 含义
P _P_ 代表周期。 放置在时长表示的开始处。
Y
M
D
T 在时间分量之前的指示符。
H 小时
M 分钟
S 秒钟
moment.duration().toISOString();

Returns duration in string as specified by ISO 8601 standard.

moment.duration(1, 'd').toISOString() // "P1D"

Format PnYnMnDTnHnMnS description:

Unit Meaning
P _P_ stands for period. Placed at the start of the duration representation.
Y Year
M Month
D Day
T Designator that precedes the time components.
H Hour
M Minute
S Second