I want to type the date in the form dd / mm / yyyy format but then search the database in the format YYYY-mm-dd, Please have tried everything, from a HELP Ai
I want to type the date in the form dd / mm / yyyy format but then search the database in the format YYYY-mm-dd, Please have tried everything, from a HELP Ai
In MySQL there is the STR_TO_DATE
function, which receives as its parameter string
of date and converts to a valid date in the SQL query:
SELECT STR_TO_DATE("01/12/2018", '%d/%m/%Y')
Returns: 2018-12-01
$data = substr($obj->getData(), 8, 2);
$data .= "/";
$data .= substr($obj->getData(), 5, 2);
$data .= "/";
$data .= substr($obj->getData(), 0, 4);