Jump to content

compare time in format hh:mm


blueman378

Recommended Posts

You should be able to use strtotime to convert them to a unix timestamp to compare. If that does not work properly, you can use the explode with mktime function to create a timestamp for comparison.

 

$time1 = strtotime("18:30");
$time2 = strtotime("07:30");

if ($time1 > $time2) 
    echo "Correct";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.