毫秒转 天 小时 分钟 秒

  private formatDuring(mss) {
    let days = Math.floor(mss / (1000 * 60 * 60 * 24));
    let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
    let seconds = Math.round((mss % (1000 * 60)) / 1000);
    return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
  }

毫秒转 小时 分钟 

let mss = Math.abs(beginTime.getTime() - finishTime.getTime());
    let hours = Math.floor(mss / (1000 * 60 * 60));
    let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
    return hours + "小时" + minutes + "分钟";

 

Logo

前往低代码交流专区

更多推荐