wrong convert date() PHP

Viewed 42

I used date() to convert 12H time to 24H using this code

$over = date("Y-m-d H:i:s", strtotime("2021-12-16 13:42:46 PM"));
echo $over;

but the output is this below:

1969-12-31 16:00:00

How to get rid of this, is this a bug? or my code?

sandbox

2 Answers

13:42:46 PM isn't 12h time format (PM is nonsense in 24h format), 01:42:46 PM is correct.

Related