I'm trying to concatenate a date and time so that they get the value (ISO) in MySQL so that I can insert them into the database. The line of code is this:
Example: datai = 20/04/2018
and horai = 14:27
$data = '$_POST[datai]';
$data2 = date("Y-m-d", strtotime($data)); // converter para formato definido
$hora = '$_POST[horai]'.':00'; // adicionar segundos à hora
$datahora = date('Y-m-d H:i:s', strtotime($data2.''.$hora));
However, what is received in bd is:
1970-01-01 01:00:00
Can you explain if it is possible to concatenate the date and time in this way? They are two different inputs.
The query to the database is this:
$inserirdatahora = mysqli_query ($conexao,"UPDATE minha_tabela
SET data_de_inicio = '$datahora' WHERE (id = 10)");