Reputation: 2194
$from = time();
$to = strtotime($row['clock']);
if($to<$from){
echo("Time has past.");
}
I am just trying to check if the time has past with a simple IF statement.
Currently the if statement is always true, no matter the datetime.
$row['clock'] = 2013-10-31 00:04:00
Upvotes: 0
Views: 70
Reputation: 179994
This works fine here. Make sure $row['clock']
contains what you think it does.
$from = time();
$to = strtotime('2013-11-01 00:00:00');
if($to<$from){
echo("Time has past.");
}
echos nothing on my machine, while:
$from = time();
$to = strtotime('2013-10-01 00:00:00');
if($to<$from){
echo("Time has past.");
}
echos "Time has past.".
Barring that, check that your server's time is correctly set.
Upvotes: 3