3
I’m picking up a date in form and in firefox the DATE field behaves like a normal text field. Ai, if the person type a date in the format dd/mm/yyyy
, I have a function that converts this date to save in Mariadb(Mysql). The problem is that in Chrome the date is already formatted, there is no need for this formatting!
What I want to do is check to see if this date already in the right format, because if you are want to ignore the formatting.
follows the function:
function traduz_data_para_banco($parametro){
if($parametro === null){
echo "data nula";
return;
}
$data_picada = explode("/",$parametro);
$data_USA = "{$data_picada[2]}" . "-" . "{$data_picada[1]}" . "-" . "{$data_picada[0]}";
return $data_USA;
}