hi.
I have another simple compare.
But one question:
- What happens when current time is late 23:00:00
and the time to compare with is next day 02:00:00?
Dont you have to include the DAY in your compares??
Anyway, here is my suggestion.
It uses this compare statement, where $test can be "22:00:00"
if(str_replace(':','',$test) < date('His'))
Here is my commented version, and 'The Short Version'
<?php
$test = '22:00:00';
// replace semicolon with empty ''
$comp = str_replace(':', '', $test);
$t = time();
// will make like: '151720'
$now = date('His', $t);
$longnow = date('H:i:s', $t);
// compare strings
if($comp < $now)
echo $test.' is less than '.$longnow;
else
echo $test.' is greater than '.$longnow;
echo '<hr>';
////////////////////////////////////////////////////////
// Short version, compare with current time
$test = '06:20:47';
if(str_replace(':','',$test) < date('His'))
echo $test.' is less than now';
else
echo $test.' is greater than now';
?>