Sherzy
7/25/2016 - 10:27 PM

Days Hours Minutes from miliseconds

Days Hours Minutes from miliseconds

function dhm(ms){
    days = Math.floor(ms / (24*60*60*1000));
    daysms=ms % (24*60*60*1000);
    hours = Math.floor((daysms)/(60*60*1000));
    hoursms=ms % (60*60*1000);
    minutes = Math.floor((hoursms)/(60*1000));
    minutesms=ms % (60*1000);
    sec = Math.floor((minutesms)/(1000));
    return days+":"+hours+":"+minutes+":"+sec;
}

  console.log(dhm(2289465807));