You can use DateTimeFormat by applying the formats as you like.
Eye: In the 24 hour format, 12:00 AM equals midnight (00:00), if you want to present it to you as 12:00 you will have to use the 12 hour (h) format.
Example:
VIEW DEMO
<?php //php 7.0.8
$date = new DateTime("12/22/2017 12:00 AM");
$date1 = new DateTime("12/22/2017 12:00 PM");
$date2 = new DateTime("12/22/2017 1:00 AM");
$date3 = new DateTime("12/22/2017 1:00 PM");
echo "Formato fecha: dd-mm-yyyy * Hora 12 AM: 12 horas (h) -> " .$date->format('d-m-Y h:i:s')."\n";
echo "Formato fecha: dd-mm-yyyy * Hora 12 AM: 24 horas (H) -> " .$date->format('d-m-Y H:i:s')."\n";
echo "Formato fecha: dd-mm-yyyy * Hora 12 PM: 12 horas (h) -> " .$date1->format('d-m-Y h:i:s')."\n";
echo "Formato fecha: dd-mm-yyyy * Hora 12 PM: 24 horas (H) -> " .$date1->format('d-m-Y H:i:s')."\n";
echo "Formato fecha: dd-mm-yyyy * Hora 1 AM: 12 horas (h) -> " .$date2->format('d-m-Y h:i:s')."\n";
echo "Formato fecha: dd-mm-yyyy * Hora 1 PM: 24 horas (H) -> " .$date3->format('d-m-Y H:i:s')."\n";
?>
Result:
Formato fecha: dd-mm-yyyy * Hora 12 AM: 12 horas (h) -> 22-12-2017 12:00:00
Formato fecha: dd-mm-yyyy * Hora 12 AM: 24 horas (H) -> 22-12-2017 00:00:00
Formato fecha: dd-mm-yyyy * Hora 12 PM: 12 horas (h) -> 22-12-2017 12:00:00
Formato fecha: dd-mm-yyyy * Hora 12 PM: 24 horas (H) -> 22-12-2017 12:00:00
Formato fecha: dd-mm-yyyy * Hora 1 AM: 12 horas (h) -> 22-12-2017 01:00:00
Formato fecha: dd-mm-yyyy * Hora 1 PM: 24 horas (H) -> 22-12-2017 13:00:00
Very important
If the data is to be stored in the database, I recommend that the warehouses unformatted and that the format be given in the output. Storing data formatted in the database (especially dates) is not a good idea, since many times we need to present such data in different formats or we need to make calculations with them. If they are formatted at the origin, any of these operations would be complicated. And the calculations could not be made directly on the data, you would have to read them, convert them and then calculate what, besides tedious, could be wrong.