Jump to content

Ichibanj

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ichibanj

  • Rank
    Newbie
  1. The confusion is that some people will think 12:00pm means noon and some people will think it is midnight. It's one of those things that people debate, but regardless of what is correct some people may get confused. I was hoping it would be some kind of simple if statement squeezed into this code. I'm not a php coder, it took me a full day to produce the code I showed and even then it felt like a miracle I got it working! Thanks @ZulfadlyAshBurn for that but unfortunately that resulted in a fatal error.
  2. It's in case some people think 12:00 pm means midnight instead of noon, and since the events are online and around the world we're worried about people getting confused.
  3. 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"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.