My objective is to convert a mySQL database item now in a 24-hour time format to a 12-hour AM/PM format using the PHP that queries and adapts the data for use in a calendar.
Current mySQL item example:
(Name) start_time | (Type) varchar(20) | (Collation) utf8_general_ci |
(Null) No | (Default) None
Current database PHP query/array item:
$timetable->start_time = $db_timetable['start_time'];
Returns the database content as entered, i.e.: 13:30
Proposed database PHP query/array item:
$timetable->start_time = DATE_FORMAT($date,
'%r'($db_timetable['start_time']));
Want it to be converted to: 1:30 PM
I’ve tried numerous variations on the proposed query, but with no luck. Any suggestions would be appreciated.