📜  小时到天的转换 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:26.877000             🧑  作者: Mango

代码示例1
function SplitTime(numberOfHours){
    var Days=Math.floor(numberOfHours/24);
    var Remainder=numberOfHours % 24;
    var Hours=Math.floor(Remainder);
    var Minutes=Math.floor(60*(Remainder-Hours));
    return({"Days":Days,"Hours":Hours,"Minutes":Minutes})
}

var hours=27.3
    var timeResult=SplitTime(hours)
    console.log("27.3 hours translate to  "+timeResult.Days+"Days "+timeResult.Hours+"Hours and "+timeResult.Minutes+"Minutes.")