Reputation: 319
I need to convert 4 digit times to am/pm and can do that using this function: date("g:ia",$starttime) which converts 08:30 to "8:30am".
But I want times that are on the hour to hide the zero minutes. So I want 09:00 to be displayed as "9am". Is there something built into php to easily do this?
Upvotes: 1
Views: 716
Reputation: 66
$date = date("g:ia",$starttime);
$date = str_replace(":00", "", $date);
Upvotes: 5