I am wanted to see which date is older/newer?
Can I use:
$start_date="2008-08-10"; $end_date="2008-09-13";
if($start_date<$end_date) { echo "start is less than end"; }
It doesn't seem to work 100% for me. How best can I compare dates?
-dr
if(strtotime($start_date) < strtotime($end_date)) // do stuff
One of the reasons why YYYY-MM-DD is the international standard is that it does compare correctly when treated as a string. If you want to make that explicit you could use [man]strcmp[/man] instead.
So do you have an example of when it doesn't work?