moment.duration().seconds();
moment.duration().asSeconds();
要获取时长的秒数,则使用 moment.duration().seconds()
。
它将会返回 0 至 59 之间的数字。
moment.duration(500).seconds(); // 0
moment.duration(1500).seconds(); // 1
moment.duration(15000).seconds(); // 15
如果想要时长的长度(以秒为单位),则改用 moment.duration().asSeconds()
。
moment.duration(500).asSeconds(); // 0.5
moment.duration(1500).asSeconds(); // 1.5
moment.duration(15000).asSeconds(); // 15
moment.duration().seconds();
moment.duration().asSeconds();
To get the number of seconds in a duration, use moment.duration().seconds()
.
It will return a number between 0 and 59.
moment.duration(500).seconds(); // 0
moment.duration(1500).seconds(); // 1
moment.duration(15000).seconds(); // 15
If you want the length of the duration in seconds, use moment.duration().asSeconds()
instead.
moment.duration(500).asSeconds(); // 0.5
moment.duration(1500).asSeconds(); // 1.5
moment.duration(15000).asSeconds(); // 15