(I indicate with numbers and letters so that the question is better understood)
I made a form in html that sends a date:
<input type="date"> //(no DateTime)
then php has to "Format" this Date and "Convert" it to String to make a mysql query.
The problem I have is that:
(0) The date that I am receiving is of type "Date"?
(1) The Date is in the format 2017-10-09 and I want to format it in 2017/10/09
(2) This Date I want to convert it to String (to later use it in the mysql query)
(A) I tried to solve it in several ways, but all resulted in error:
$myDate = date_format($_POST['fechaDesde'],"Y/m/d"); //(1)
$fechaDesde = $myDate->format('Y/m/d'); //(2)
echo $fechaDesde; //debería tener String: 2017/10/09
(B) Another failed attempt:
$myDate = $_POST['fechaDesde'];
$fecha = Date::createFromFormat('Y/m/d', $myDate); //(1)
$fechaDesde = $fecha->format('Y/m/d'); //(2)
echo $fechaDesde; //debería tener String: 2017/10/09