MomentJS - Seconds

此方法将给出持续时间内的秒数。返回的值将在 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.html