How do I insert a date null
into this function?
$data_saida = $this->post('data_saida');
//aqui pega a data se não for vazia e formata
if($data_saida) {
$arraydata = explode("/", $data_saida);
$diamontado = $arraydata[2].'-'.$arraydata[1].'-'.$arraydata[0];
$data_saida = $diamontado;
}
The problem is that this date is not required and if the user does not put anything in form
, it saves a date type 0000-00-00.