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>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.