PHP中是否有将Minutes转换为人类可读格式的函数?
例如,将小时转换为分钟
$weekday = 2 //Tuesday
$OpenTime = "18:00"
$open = explode(':',$OpenTime);
$MinutesOpen = $weekday * ($open[0] * 60 + $open[1]);
echo $MinutesOpen;
$MinutesOpen
将是2160
如何将其转换回HH:MM格式?
答案 0 :(得分:2)
$str = sprintf('%02d:%02d', floor($min/60), $min%60)
答案 1 :(得分:0)
$hoursminsandsecs = date('H:i:s',strtotime($MinutesOpen));