Support

Account

Home Forums Add-ons Repeater Field Frontend time display issue

Unread

Frontend time display issue

  • Hi guys, new to this and hope to get some help, please.

    We have a real estate site using ACF to set time and date for opening. Recently the time field shows time an hour more in frontend then what admin set in the backed, for example, we set time to 11.00 am, the frontend would show as 12am.

    The site currently runs on WordPress version 5.3.2 and ACF Version 5.8.7. We are in time zone UTC+10. Server time is set up correctly. We are in the summertime period that is an hour ahead.

    The code for the front end display:

    <div class=”tab-pane fade”>
    <div id=”inspections” class=”property-inspections detail-block target-block”>
    <div class=”detail-title”>
    <h2 class=”title-left”><?php esc_html_e( ‘Inspection:’, ‘houzez’ ); ?></h2>
    </div>
    <b><?php esc_html_e( ‘As Advertised or by Appointment’, ‘houzez’ ); ?></b>

    <?php
    // check if the repeater field has rows of data
    if( have_rows(‘property_inspection’) ):
    date_default_timezone_set(‘Australia/Sydney’);
    // loop through the rows of data

    while ( have_rows(‘property_inspection’) ) : the_row();
    // display a sub field value
    if(time()< strtotime(get_sub_field(‘inspection_date’).” “.get_sub_field(‘to_inspection_time’))){
    echo ‘‘.get_sub_field(‘inspection_date’).’ ‘.esc_attr( get_sub_field(‘from_inspection_time’) . “-” . get_sub_field(‘to_inspection_time’)).’
    ‘;
    }

    endwhile;

    endif;
    ?>
    </div>

    Any help would be greatly appreciated.

Viewing 1 post (of 1 total)

The topic ‘Frontend time display issue’ is closed to new replies.