- time: documentation ( source)
- md5: documentation ( source)
<?php
function ceil300($time,$const) { // function returns timestamp rounded to next 300 seconds ( 5 minutes ) + const
if ($time % 300 == 0) return $time + $const;
return $time + (300 - ($time % 300)) + $const;
}
$time = time();
$const = 210; // 210 seconds = 3:30
// getting actual time and constant
$act_time = md5(ceil300($time,210));
$lst_time = md5(ceil300($time-300,210));
echo $act_time ."<br>";
echo $lst_time;