1
I want to insert an HTML FORM that I made the field DATE
, however it is in format dd/mm/yyyy
and mysql only accepts yyyy-mm-dd
. How do I convert the date to insert correctly into the Mysql database using PHP?
I tried to find several places and nothing that would help me, because the date saved in the comic book is always nothing to do with the typed when I go to check.
Currently my code has the field DATA
in this format:
$dataOld=date("d/m/Y");
$data=date("Y-m-d", strtotime($dataOld));
$venc_garantiaOld=date("d/m/Y");
$venc_garantia=date("Y/m/d", strtotime($venc_garantiaOld));
PS: I don’t know if it interferes with the conversion, but I’m using a jQuery mask for the field DATE
, is there a problem?
Other options, http://answall.com/questions/21774/comort-inverter-datas-no-php-independente-format
– rray
I tried the function that is in the link, but it didn’t work with me. Do you have another suggestion? in Mysql even with the function it saves with the system date in BD.
– DarkJontex