I have problem to convert one of my dates in YYY-d-m format.
I have the array $searchQuery, which when print using print_r, prints the foloowing output:
Array ( [selectedArea] => 0
[checkin] => 30/07/2014
[checkout] => 01/08/2014
[rooms] => 1
[adults] => 2
[childrens] => 0 )
I have the following code:
echo "Checkin is:" .$searchQuery['checkin']."<br />";
$what = strtotime($searchQuery['checkin']);
echo "New checkin is:" .$newCheckin = date('Y-m-d', $what) ."<br />";
echo "Checkout is:" .$searchQuery['checkout']."<br />";
$newCheckOutTemp = strtotime($searchQuery['checkout']);
echo "New checkout is:" .$newCheckout = date('Y-m-d', $newCheckOutTemp) ."<br/>";
Which prints the following:
Checkin is:30/07/2014
New checkin is:1970-01-01 ------>????
Checkout is:01/08/2014
New checkout is:2014-01-08
I have two questions...why the first date is printing 1970-01-01 when converted, and second, how can i the difference in days between those 2 dates.
Any help will be deeply appreciated.
Regards, John