DateTime::format method

<?php

$timeIn12HourFormat = '5:30 PM';

$dateTime = new DateTime($timeIn12HourFormat);
$timeIn24HourFormat = $dateTime->format('H:i');

echo $timeIn24HourFormat;

Leave a Comment

Your email address will not be published. Required fields are marked *