I have an array of date strings like this in php.
28.09.18 13:42
28.09.18 14:12
28.09.18 21:18
28.09.18 21:23
28.09.18 21:28
10.04.19 23:36
My goal is to change the format to something like Y-m-d H:i:s
. So I try this code.
foreach($dates as $date) {
echo date('Y-m-d', strtotime($date)).PHP_EOL;
}
The output looks like this:
2018-09-28
2018-09-28
2018-09-28
2018-09-28
2018-09-28
1970-01-01
As you can see the last date is wrong. Why it's not parsed probably? Is there any solution for this?