format date
Posted: Wed Dec 17, 2008 1:30 am
i have been trying to convert a posted parameter from a textbox like '12/09/2008' m/d/Y to 'Y/d/m' but seem to be deleting the date when im trying to pass a variable instead of a string : see
$startDate = $_POST['arrival'];
$endDate = $_POST['departure'];
$ArrivalDate = new DateTime("@$startDate");
$DepartureDate = date("Y-d-m",strtotime("@$endDate"));
echo $ArrivalDate->format("Y/m/d");
echo $DepartureDate."<br>";
but both give me the same result. this 1970-01-01. Why?
the php version has been updated to the version 5.2.6
regards.
$startDate = $_POST['arrival'];
$endDate = $_POST['departure'];
$ArrivalDate = new DateTime("@$startDate");
$DepartureDate = date("Y-d-m",strtotime("@$endDate"));
echo $ArrivalDate->format("Y/m/d");
echo $DepartureDate."<br>";
but both give me the same result. this 1970-01-01. Why?
the php version has been updated to the version 5.2.6
regards.