CODE RESULTS $a = floor(3.5); //3 $b = round(3.5, 0, PHP_ROUND_HALF_DOWN); //3 var_dump($a); //float(3) var_dump($b); …
Tag: floor
Round minute down to nearest quarter hour
I need to round times down to the nearest quarter hour in PHP. The times are being pulled from a MySQL database from a datetime column and formatted like 2010-03-18 10:50:00. Example: 10:50 needs …