Support

Home Forums Custom Files Add-on (EE3) Change Time Format Revisited

Change Time Format Revisited

Posted: June 28, 2012 at 10:52 am


amansker

June 28, 2012 at 10:52 am

I’m starting a new post to avoid confusion with the earlier post. Hope that meets protocol.

My problem was not resolved. Let me clarify:

I’m using table_display.php. By default it uses a 24 hour clock for start times. The admin time format in WordPress/Expresso is already set to a 12 hour clock. How can I display a 12 hour start time?

I found this on the wiki and it worked great showing the date, but when I modify to time code format, it displays 12:00 for my events scheduled for 5:00pm. It always reports 12:00.

I am not a php programmer, but have worked in and around LAMP apps for 15 years. I follow instructions well, but don’t understand things like “undeclared function”.

thanks

  • This topic was modified 11 years, 10 months ago by  Josh. Reason: Moving to custom files forum


amansker

June 28, 2012 at 10:58 am

It seems each time I post I have some sort of revelation. My paste didn’t work above. It was:

I changed start_date to start_time and made progress. The days with a single event properly display 5:00pm now. Unfortunately, days with 3 start times are showing the middle start time for all 3 rows/records instead of showing 1:00, 3:00, 5:00, it shows 3:00 for all three.


Chris Reynolds

  • Support Staff

June 28, 2012 at 11:50 am

There isn’t a simple solution to what you are trying to do. This is because, in any given event there could be 1 time or 3 times or 10. The times are stored in an array, which means to display a time other than the default time that displays, you’d need to call that array value specifically. But since you don’t know (and can’t know, more specifically) what that value will be, or how many values there are for any given event — at least without of a lot more php code and sql queries — you really have no way of displaying a list of all possible times.

Rather than futzing around with the dates and times that are being pulled from the database, you could just add that information to the Event Meta for that event. Set your meta key to something like ‘event_time_list’ and the value would be something like this:

<ul><li>1:00</li><li>3:00</li><li>5:00</li></ul>

Then in your template file do

<?php echo do_shortcode('[EE_META type="event_meta" name="event_time_list"]'); ?>

That should get you where you want to go.

  • This reply was modified 11 years, 10 months ago by  Chris Reynolds.
  • This reply was modified 11 years, 10 months ago by  Chris Reynolds.
  • This reply was modified 11 years, 10 months ago by  Chris Reynolds. Reason: trying to clean up html tags
  • This reply was modified 11 years, 10 months ago by  Chris Reynolds. Reason: but it didn't work


amansker

June 28, 2012 at 12:15 pm

Thanks, I will try this later and report back.


amansker

July 2, 2012 at 3:51 pm

Sorry about the delay, crazy here. Thanks for posting that solution. Since this is for the client, I wanted to KISS it. I just changed the way I entered events. Instead of One event for the day with multiple times, I used a single event for each time of the day (over multiple days). This shows all times for each day and, in my case, wasn’t that much more effort.

The support post ‘Change Time Format Revisited’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso