更新时间:2023-02-12 17:01:03
转换单位:
var milliseconds = (startdate.getTime() - currentDate.getTime());
var seconds = milliseconds / 1000;
var minutes = seconds / 60;
或者,一体化:
var minutes = (startdate.getTime() - currentDate.getTime()) / 1000 / 60;
这最有可能给你一个大小数。对于舍入,请使用 Math.floor
, Math.ceil
或 Math.round
。
This will give you a big decimal most likely. For rounding, use Math.floor
, Math.ceil
, or Math.round
.