Hi there
This code below displays the time in different timezones, from a base time of Los Angeles time, and it's working well for us (the time is pulled from the start date field of an event post type within Wordpress). However, if an event is at midday it puts 12:00 pm for the time which can cause confusion internationally as to whether it is midnight or midday.
We'd like to display "12:00 noon" instead of "12:00 pm". Does anyone have any idea how this code could be adapted to do this?
This code will be used in a Wordpress site so the way the time is displayed is set there. However, Wordpress doesn't have a way to change just this one things that we're looking to do which is to change '12:00 pm' to '12:00 noon'.
Thanks!
<?php
$tas_start_datetime = tribe_get_start_date();
?><strong>Los Angeles, USA: </strong><?php
$date = new DateTime($tas_start_datetime, new DateTimeZone('America/Los_Angeles'));
echo $date->format('l, F j\, g:i a') . "\n";
?><br/><strong>Detroit, USA: </strong><?php
$date->setTimezone(new DateTimeZone('America/Detroit'));
echo $date->format('l, F j\, g:i a') . "\n";
?><br/><strong>Accra, Ghana: </strong><?php
$date->setTimezone(new DateTimeZone('Africa/Accra'));
echo $date->format('l, F j\, g:i a') . "\n";
?><br/><strong>London, UK: </strong><?php
$date->setTimezone(new DateTimeZone('Europe/London'));
echo $date->format('l, F j\, g:i a') . "\n";
?><br/><strong>Lagos, Nigeria: </strong><?php
$date->setTimezone(new DateTimeZone('Africa/Lagos'));
echo $date->format('l, F j\, g:i a') . "\n";
?><br/><strong>Auckland, New Zealand: </strong><?php
$date->setTimezone(new DateTimeZone('Pacific/Auckland'));
echo $date->format('l, F j\, g:i a') . "\n";
?>