I am working on a test site in preparation for designing a newspaper website. The AP style for times is a.m. and p.m., but the PHP default is am and pm (or AM and PM). I have been searching for a way to change the way that times display (as I have created a Time field for all stories, so that the time that the story was posted or last revised is displayed) so that they display correctly in the story (and in the teaser) as a.m. and p.m.
I'm not at all fluent in PHP (what I know could be summed up in a sentence or two), so I've been trying to find a solution I can implement on my own, since I can't write a solution myself in PHP.
While researching the problem online, I found a plug-in that someone had created for WordPress:
function ap_time() {
$capnoon = get_option('ap_capnoon');
// Format am and pm to AP Style abbreviations
if (get_the_time('a')=='am') :
$meridian = 'a.m.';
elseif (get_the_time('a')=='pm') :
$meridian = 'p.m.';
endif;
// Reformat 12:00 and 00:00 to noon and midnight
if (get_the_time('H:i')=='00:00') :
if ($capnoon == "true") :
$aptime = "Midnight";
else :
$aptime = "midnight";
endif;
elseif (get_the_time('H:i')=='12:00') :
if ($capnoon == "true") :
$aptime = "Noon";
else :
$aptime = "noon";
endif;
// Eliminate trailing zeroes from times at the top of the hour and set final output
elseif (get_the_time('i')=='00') :
$aptime = get_the_time('g')." ".$meridian;
else :
$aptime = get_the_time('g:i')." ".$meridian;
endif;
echo $aptime;
}Is there any way to adapt this for use in Drupal? Specifically, in ProsePoint?