Support

Account

Home Forums ACF PRO ACF PRO: How to return the DAY from a Date Picker? Reply To: ACF PRO: How to return the DAY from a Date Picker?

  • Your code is working correctly for me.

    Are you sure that you have your date picker returning the date in the Ymd format? (See the attached screenshot of the ACF interface where the return format is set.) You can just echo get_field('event_date') to check the format you’re getting back.

    Alternately, you could do it in procedural style this way, which should work no matter what format is being returned:

    <?php $date = strtotime(get_field('event_date')); ?>
    <span><?php echo date('d', $date); ?></span>
    <span><?php echo date('M', $date); ?></span>