Reputation: 61
PHP date provides formatting for date as follows
a for am,pm
or
A for AM,PM
whereas I need as follows:
a for a.m., p.m. //including the abbreviation periods.
A for A.M. , P.M.
Is this possible?
Upvotes: 0
Views: 330
Reputation: 732
My two cents:
$date = date('Y-m-d h:i:s a');
$s = array(' am', ' AM', ' pm', ' PM');
$r = array(' a.m.', ' A.M.', ' p.m.', ' P.M.');
$date = str_replace($s, $r, $date);
(you could make a function)
Upvotes: 4