MomentJS - 秒



此方法將給出持續時間中的秒數。返回的值介於 0-59 之間。如果您想要持續時間內的秒數的適當長度,請使用 **moment.duration().asSeconds().**

語法

moment.duration().seconds();
moment.duration().asSeconds();

示例

var a = moment.duration(20000).seconds();

輸出

如果您想要顯示持續時間內的秒數的長度,請使用 moment.duration().asSeconds() 如下 -

示例

var a = moment.duration(600).asSeconds();

輸出

Seconds
momentjs_durations.htm
廣告
© . All rights reserved.