Since i read another few topic with similar problem i dont understand what is wrong in my situation date is sorted with - in both case so date 03-14-2020 should become 2020-14-03 but become 1970-01-01
$dates = explode(" / ", $this->input->post('date'));
print_r($dates);
Array ( [0] => 03-14-2020 [1] => 03-20-2020 )
$newDate = array(
'start' => date("Y-m-d", strtotime($dates[0])),
'end' => date("Y-m-d", strtotime($dates[1]))
);
print_r($newDate)
Array ( [start] => 1970-01-01 [end] => 1970-01-01 )
even this way is not showing correct
$date = DateTime::createFromFormat('d-m-Y', $dates[0]);
print_r($date->format('Y-m-d'));
2021-02-03