Support

Account

Home Forums Front-end Issues Date picker format in repeater -> repeater

Solved

Date picker format in repeater -> repeater

  • I have a repeater within a repeated and have used the field ‘Date Picker’

    What I have been trying to do is output it so that it can be used in different areas so for example if the date was 25/12/2017

    Part of it would show 25 – Mon

    Another would be December 2017

    etc.

    `<?php
    // get raw date
    $date = get_field(‘event_date’, false, false);

    // make date object
    $date = new DateTime($date);
    ?>
    <div class=”date_and_month”>
    <i class=”fa fa-calendar-o”></i>
    <div class=”date_and_day”>
    <span><?php echo $date->format(‘d’); ?></span>
    <p><?php echo $date->format(‘D’); ?>.</p>
    </div>
    </div>`

    Any tips cause currently all I’ve found is above and that changes to, today date…

  • For some reason won’t format the code how it should do normally…

  • Solved!

    Since it’s in an repeater, it needed to be;

    $date = get_sub_field('event_date', false, false);

    instead of “get_field” it needed to be “get_sub_field”

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Date picker format in repeater -> repeater’ is closed to new replies.