davefootball123 Posted March 16, 2013 Share Posted March 16, 2013 I have a really easy php function that displays the current time + a certain amount of time...seen below. Is there a way to round the time to the nearest 10 minutes? Thanks, Dave $duration = date("hi A", strtotime("+45 minutes")) Link to comment https://forums.phpfreaks.com/topic/275747-rounding-php-time/ Share on other sites More sharing options...
Barand Posted March 17, 2013 Share Posted March 17, 2013 10 mins is 600 seconds, so $duration = strtotime("+45 minutes"); $duration = round($duration/600) * 600; $duration = date('hi A', $duration); Link to comment https://forums.phpfreaks.com/topic/275747-rounding-php-time/#findComment-1419080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.