I have built a clocking in and clocking out program and i am recording everything fine but i need the times to be rounded up to the next 15 minutes.
I am currently using the below code which would sometimes round up sometimes round down.
// Round Time to Next 15 mins
$CurrentTime = date('H:i:s');
$CurrentTime = strtotime($CurrentTime);
$precision = 60 * 15;
$NewTime = date('H:i:s', round($CurrentTime / $precision) * $precision);
It doesnt matter what the time is, it just always has to jump to the next 15 minutes (i.e. Quarter Past, Half Past, Quarter Too, On the Clock)