Convert 24 hour time to 12 hour time

This example converts 24 hour formatted date to 12 hour formatted dates

<?php
function Convert24to12($time)
{
    return date(‘g:i:sa’, strtotime($time));
}
/*some examples follow*/
echo Convert24to12(’12:12:12′).'<br />’;
echo Convert24to12(’12:12′).'<br />’;
echo Convert24to12(’08:12:12′).'<br />’;
echo Convert24to12(’08:12′).'<br />’;
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*