I have two datepickers in format dd/mm/YYYY. Problem is that when I store them to database, they got buggy. Output is "1970-01-01'. I am also using mySQL STR_TO_DATE function and php built in function for date format... I don't know why my dates are not working. Can someone told me why my dates got buggy?
Here is code that I am using:
$datumDO=$_POST['datepicker'];
$datumOD=$_POST['datepicker1'];
$time = strtotime($datumDO);
$NewDatum = date('d/m/Y',$time);
$time = strtotime($datumOD);
$NewDatumOD = date('d/m/Y',$time);
if ($stmt = $dbConnection->prepare("INSERT INTO `cat-item` (id_cat, id_item, datumOD, datumDO) VALUES (?,?,STR_TO_DATE(?,'%d/%m/%Y'),STR_TO_DATE(?,'%d/%m/%Y'))")){
$stmt->bind_param('iiss', $category, $item, $NewDatum , $NewDatumOD;
$stmt->execute();
$stmt->close();
}