javascript 将毫秒值转换为天-小时-分钟-秒钟

var start_timeMS = new Date(start_date).getTime();
var end_timeMS = new Date(end_date).getTime();
var use_days = parseInt((end_timeMS - start_timeMS) / 1000 / 60 / 60 / 24); //转换为天
var use_hours = parseInt((end_timeMS - start_timeMS) / 1000 / 60 / 60 % 24); //转换为小时
var user_min = parseInt((end_timeMS - start_timeMS) / 1000 / 60 % 60);//转换为分钟
var user_second = parseInt((end_timeMS - start_timeMS) / 1000 % 60);//转换为秒

  

转载于:https://www.cnblogs.com/MainActivity/p/8377255.html

你可能感兴趣的:(javascript)