我有代码,我需要到达的数字返回十进制后 1 或 2 位而不是像现在这样的 15,这就是我所拥有的。
function GetDiff (dt) {
sMins = " Min";
sHours = " Hrs";
sDays = " Days";
if ( Math.abs (DateDiff ("n", now, dt)) < 1440 ) {
if ( Math.abs (DateDiff ("n", now, dt)) <= 60 ) {
return (Math.abs (DateDiff ("n", now, dt)) + sMins);
}
else
{
return (Math.abs (DateDiff ("n", now, dt)/60) + sHours);
}
}
else
{
return (Math.abs (DateDiff ("n", now, dt)/1440) + sDays);
}
}