Hello i am learning php i tried to use the date function to display the current time.
I have an if statement to check the current time whether it is greater than the next hour.
Here is the code
<?
$current_time= date('G:i:s');
$next_time= date('G:i:s',strtotime('+1hour'));
if($current_time > $next_time )
{
echo $current_time." is greater than ".$next_time;
}
?>
At the time of writing this code it was 9:23:39
and the next hour should have been 10:23:39
Surprisingly i got :
9:23:39 is greater than 10:23:39
Am i missing something here.
Please help
you could use a integer to work the if statement
to get the number of Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) thus giving you a number which you can determine which one is greater.