checking dates not working

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

 



I have this bit of code to see if a date is greater or equal to a set date.

echo(date("m/d/Y",strtotime($jobs_effective_start)));// displays entered date of 01/03/2012
echo(date("m/d/Y",strtotime(WSOFFBEGIN))); // displays set date of 09/16/2011

if (!(date("m/d/Y",strtotime($jobs_effective_start)) >=  date("m/d/Y",strtotime(WSOFFBEGIN)))) {
                $error.="The effective start date must be AFTER ".WSOFFBEGIN."\n"; unset($_POST["jobs_effective_start"]);
}

My error message is displaying. The if statement is executing as true, as if 01/03/2012 is not greater or equal to 09/16/2011.
This is not correct since a date in 2012 should be greater than a date in 2011.

If I use 12/31/2011 as the $job_effective_start date the error message is not displayed since 12/31/2011 is greater than 09/16/2011 and the if statement executes as fasle.

Any ideas on why a 2012 date is treated as not greater than a 2011 date?

Thanks

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