Can't get the correct start date / time

WordPress Event Management, Calendars & Registration Forums General Question Can't get the correct start date / time

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 6 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30344

    Hi there,

    we’ve been trying to make our custom events archive and single pages – but unfortunately we’re unable to retrieve the correct date. Using WP the_date() will only return month and year.

    We’ve tried to use eo_get_the_start( ) and pretty much any other function that is described in your docs, but failed to retrieve the event start time. The returns are usually “crazy” numbers, I suppose it’s because the start and end times are relative numbers that belong to a timezone? We’re aware that some functions return in PHP-datetime format but still weren’t able to display the correct time.

    Please tell us how to display the start time in archive-event.php (copied from the event plugin templates) in the loop.

    Thanks,
    Manuel.

    Manuel Geissinger
    #30354

    Hi Manuel,

    You probably want to edit eo-loop-single-event.php unless you want to edit the wider structure of the page.

    In any case, you can do the following:

     echo eo_get_the_start('G:ia');
    

    The argument determines the format. http://codex.wp-event-organiser.com/function-eo_get_the_start.html

    Stephen Harris
    #30364

    Hi Stephen,

    I’ve tried now

     echo eo_get_the_start('G:ia');
    

    But as before the dates aren’t correct. The output is

    0:00am

    for every event, while in the WordPress backend the dates are displayed correctly.

    Manuel Geissinger
    #30386

    Hi Manuel,

    What do you get if you do:

     global $post;
     var_dump( $post->occurrence_id );
     var_dump( $post->StartDate );
     var_dump( $post->StartTime );
    
    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.