Reputation: 1105
I have this code:
$total_days = 0;
$minutes = 1200;
echo date('H:i', mktime(0, $minutes));
This return me 20 hours, which means two 8 hours + 4 hours working day. It means that in the $total_days
will have 2 days + 4 h. How can I divide the 1200 minutes to get 2 days and 4 hours ?
Upvotes: 0
Views: 54
Reputation: 31749
Calculate it manually -
$minutes = 1200;
$total_hours = $minutes / 60;
echo floor($total_hours / 8). ' days ' . ($total_hours % 8). ' hours';
Output
2 days 4 hours
$total_hours
contains fractinal value then the calculation should be changed accordingly.
Upvotes: 3