js把毫秒数转为天,小时分钟,比如100000000毫秒转换为xx天xx小时xx分钟,怎么转换?
var days = shijiancha / 1000 / 60 / 60 / 24;
var daysRound = <a href="https://www.baidu.com/s?wd=Math.floor&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLmyD1rjPWuWmYPWR4uAc10ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHmLnjR3n1fvPH64nWD1rHRsPs" target="_blank" class="baidu-highlight">Math.floor</a>(days);
var hours = shijiancha/ 1000 / 60 / 60 - (24 * daysRound);
var hoursRound = <a href="https://www.baidu.com/s?wd=Math.floor&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLmyD1rjPWuWmYPWR4uAc10ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHmLnjR3n1fvPH64nWD1rHRsPs" target="_blank" class="baidu-highlight">Math.floor</a>(hours);
var minutes = shijiancha / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
var minutesRound = <a href="https://www.baidu.com/s?wd=Math.floor&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLmyD1rjPWuWmYPWR4uAc10ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHmLnjR3n1fvPH64nWD1rHRsPs"target="_blank" class="baidu-highlight">Math.floor</a>(minutes);
var seconds = shijiancha/ 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
js 中把毫秒数转化成具体时间如下:
var oDate = new Date();
var iM = oDate.getTime(); //得到毫秒数
var nDate = new Date(iM0; //直接将毫秒数当参数传进去。
alert(nDate); //这个时候弹出的就是具体的“星期”、”月“、”日“、”年“的格式。