I have the following code of which I want to retrieve dates from db. The code outputs the disered list, but in different date format.
$array = $stmt->fetchAll(PDO::FETCH_COLUMN);
$dates = implode("\n",$array);
return $dates;
Result is:
2021-05-26
2021-05-27
2021-05-28
2021-05-29
2021-05-30
I need this format: m/d/Y
I tried this:
`$array = $stmt->fetchAll(PDO::FETCH_COLUMN);
$dates = implode("\n",$array); $newDate = date("m/d/y", strtotime($dates)); return $newDate;`
But the result is just one result and wrong:
01/01/70
Format changed but i lost the correct dates
Thanks in advance.