PHP Get random time of day

Get a random time of day between Midnight and 11:59:59.
Technically it returns a pseudo-random time of day.
$timeFrom = strtotime('0:00');
$timeTo = strtotime('23:59:59');
$randomTime = date("H:i:s",mt_rand($timeFrom, $timeTo));
echo $randomTime;
Posted by
Snippet Viewed 2004 times.

Share your PHP code snippets:

  • Get some recognition & link back to your site.


Submit | Browse

Most Recent php snippets

Most Viewed