I have a question about comparing dates set like that $date=new DateTime($_GET['date']);.
I know there is $date1->diff($date2); but this returns difference only.
This works fine when I made some tests:
$query='';
while ($date1 < $date2) {
$query='...'.$date->format("Y-m-d").'...;';
$date1->modify("+1 days");
}
$db->query($query);
My question: is that the right way of comparing 2 date objects? When I test it, results were ok, but is it possible I could get an error when script check while condition?
Taken from PHP manual at: http://www.php.net/manual/en/class.datetime.php
So if you are using PHP 5.2.2 or superior, you must have no problems.