Support

Home Forums Event Espresso Premium Removing the Time from Datetime in the Table Template Add-On

Removing the Time from Datetime in the Table Template Add-On

Posted: June 9, 2015 at 10:42 am

Viewing 7 reply threads


Dan

June 9, 2015 at 10:42 am

Hey guys – I’m using the Table Template Add-On and “A better Events table template” from Josh.

I’m curious – How can I hide/remove the TIME from the DateTime display? (screenshot for reference)

Frankly, I would like to do this across the entire front-end of the application. Anywhere the date and time are listed, I would prefer to show only the date. Our events are day-based, without listed times. But, for the scope of this thread, feel free to limit your solution to this table template.

Thanks,
–Phil

  • This topic was modified 9 years, 5 months ago by Dan.
  • This topic was modified 4 years, 8 months ago by Seth Shoultes.


Lorenzo Orlando Caum

  • Support Staff

June 9, 2015 at 11:26 am

Hi Phil, for the Events table view template add-on, see this tutorial:

https://gist.github.com/lorenzocaum/ac217033f12232404cce#comment-1360330

For the datetimes that are used on the event listings page and the single event pages see this tutorial:

https://eventespresso.com/topic/format-date-and-time-in-ee4/#post-93329

In the last step where you change the function to add the specified format, try this version:

ID, $dt_frmt = 'l F jS, Y', $tm_frmt = '' );?>

That should keep the date and remove the time.


Lorenzo


Dan

June 9, 2015 at 12:18 pm

Very nice. The first solution works flawlessly. Thank you very much.

The second would work, I presume, though I haven’t tested it yet.

On my single event template, I’m echoing the function espresso_event_date_range(). I updated this to be espresso_event_date_range($dt_frmt = 'F jS, Y', $tm_frmt = ''); but the time still shows.

Any word on what to do differently with that function?


Lorenzo Orlando Caum

  • Support Staff

June 9, 2015 at 1:47 pm

Okay, no problem. The date range function is used in the example for the events table view template.

What happens if you use the same example in your single event template?


Lorenzo


Dan

June 11, 2015 at 10:02 am

Using echo espresso_event_date_range( 'F j, Y', ' ', 'F j, Y ', ' ', $event->ID()); returns a fatal error.

Using echo espresso_event_date_range( 'F j, Y', ' ', 'F j, Y ', ' '); returns the Start Date only (no range) but in the desired format! Month DD, YYYY

This code is being called within a single-espresso_events.php template file in my child theme.


Dan

June 11, 2015 at 3:59 pm

I’m embarrassed to admit this…. The start and end date for the event that I was testing this on were the same! This solution works. A range is returned, in the desired format!

Thank you guys.


Dean

June 12, 2015 at 12:54 am

It’s always the simple things (for me, it’s always a missing comma somewhere in my code…)!

Anything else we can help with regarding this issue or may we mark this as resolved?


Dan

June 12, 2015 at 8:41 am

Resolved. 🙂

Viewing 7 reply threads

The support post ‘Removing the Time from Datetime in the Table Template Add-On’ 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