Something
public text v1 · immutable // function to convert 12 hour time to 24 hour
// $time = hh:mm AM/PM
function transTime($time)
{
list($h,$m) = explode(':',$time);
$h = (int)$h;
$m = (int)$m;
if(substr($time,strlen($time)-2) == 'PM')
$h += 12;
return str_pad($h,2,'0',STR_PAD_LEFT).':'.str_pad($m,2,'0',STR_PAD_LEFT);
}
echo '<p>'.transTime('11:52 AM').'</p>';
echo '<p>'.transTime('08:32 AM').'</p>';