I have a problem inserting dates in a table column mysql .
I've already tried putting the field as varchar , date , datetime and nothing.
$fecha_ant = date("Y-m-d", strtotime("-3 day")); // with this I get the current date - 3 days, it returns the correct date
My insert
$conn->exec("INSERT INTO tVentas (vendedor_id,fecha_trans,amount,tienda) VALUES($id_vendedor,$fecha_ant,$monto,0)");
When you want to insert this data in mysql if the field of mysql is as date does not insert anything and if it is as varchar instead of inserting the date, insert a number.
For example if the extracted date is "2016-11-18", insert "1987".
Reading about it, it may be something from the unix date, but I'm not sure. In DB I want to insert 2016-11-18 and not 1987