Support

Home Forums Event Espresso Premium Upgrade broken Start date & time display

Upgrade broken Start date & time display

Posted: January 29, 2017 at 9:44 pm

Viewing 2 reply threads


Jade

January 29, 2017 at 9:44 pm

Hi there

Since upgrading EE Core last week, my custom code for displaying the start date and time of an event is broken. Is it possible for you to advise how to fix this?

<?php if ( $event instanceof EE_Event ) {
                            
							
							$datetime = $event->primary_datetime();
                            if( $datetime instanceof EE_Datetime ) {

                                $eventstart = $datetime->start_date_and_time();
								$eventstart = date("l j F g.ia", strtotime($eventstart));
							}
							
							?>
                            <p class="date"><?php echo $eventstart; ?></p>

Thanks in advance!


Josh

  • Support Staff

January 30, 2017 at 8:41 am

Hi Jade,

It would have been a happy accident that the code worked before the update. Here’s how to fix:

1) You remove this line of code:
$eventstart = date("l j F g.ia", strtotime($eventstart));

2) You change the line that has this:
$eventstart = $datetime->start_date_and_time();

to be this:

$eventstart = $datetime->start_date_and_time('l j F', 'g.ia');


Jade

January 30, 2017 at 4:00 pm

Thank you!!

Viewing 2 reply threads

The support post ‘Upgrade broken Start date & time display’ 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