1. 程式人生 > >Vue 將毫秒轉換為天

Vue 將毫秒轉換為天

  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 + "秒";
  }