compare dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm puzzled why the if statement executes as true when the first date (job_closedate) is not less than the second date (now).
The if statement claims that "12/02/2011" is less than "11/30/2011".

                if (date("m/d/Y",strtotime($jobs_closedate)) <= date("m/d/Y",strtotime("now"))){

                echo date("m/d/Y",strtotime($jobs_closedate)); // displays - 12/02/2011
                                echo date("m/d/Y",strtotime("now")); // displays - 11/30/2011

                                $error.="The close date must be later than today's date, " . date("m/d/Y",strtotime("now")) . ".\n";
                }

If the first date is "11/16/2011" the if statement also executes as true which is correct since "11/16/2011" is less than "11/30/2011".

Marc

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux