Posted By

jodm on 04/07/10


Tagged


Versions (?)

Round Time to Nearest


 / Published in: PHP
 

  1. function roundTime($blnRoundDown = true) {
  2. $seconds = time();
  3.  
  4. $rounded_seconds = ($blnRoundDown) ? floor($seconds / (5 * 60)) * (5 * 60) : round($seconds / (5 * 60)) * (5 * 60);
  5.  
  6. return date('H:i', $rounded_seconds);
  7. }

Report this snippet  

You need to login to post a comment.