Outputting from a directions api I have a duration it will take the user to get from a to b. At the moment it is minutes but if the users journey will take 3 hours and 20 minutes it will output 200 minutes.
I would like it to work out that that is greater than 60 minutes. then divide by 60 and add the remainder to give
3 hours 20 minutes.
How do we do this.
Marvellous
Similarly, H will give you the hour in 24-hour format with leading zeros, but h will give you the hour in 12-hour format with leading zeros.
$date=date_create("2013-03-15"); echo date_format($date,"Y/m/d H:i:s");
The date_add() function adds some days, months, years, hours, minutes, and seconds to a date.
In case you have duration in seconds, you can format it with PHP gmdate()
function:
echo gmdate("H:i:s", $seconds);
(Note: works for durations up to 24 hours)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With