I'm attempting to convert user inputted 12 hour time to 24 hour time in php so I can better sort and report on it. below code returns 16:00 no matter what is entered.
$starttime1 = date("H:i", strtotime("$starttime"));
in this instance what is being fed to $starttime is g:i:s:A or 4:00:00:AM
In the last hour of searching it appears to be an issue with the date function not getting the right information, so I tried DateTime::createFromFormat
$starttime = DateTime::createFromFormat('g:i:s:A', $starttime);
$starttime1 = $starttime->format( 'H:i');
generates null
I feel like I'm doing something stupid.. need to take a break from coding and will keep googling, but hoping someone can point me in the right direction.