Home › Forums › Front-end Issues › Filtering CPT with date picker custom field › Reply To: Filtering CPT with date picker custom field
Hi Elliot,
I think I found my solution. I found it at the bottom of this thread:
http://support.advancedcustomfields.com/forums/topic/datepicker-wrong-format-is-displaying/
I changed my code as follows:
$date = DateTime::createFromFormat('Ymd', get_field('class_date'));
echo '<p>' . $date->format('F j, Y') . '</p>';
I changed ‘yymmdd’ to ‘Ymd’ and then changed the format value from ‘F n Y’ to ‘F j, Y’.
I’m now confused because the documentation tells us to use the save format yymmdd and since we are using the Jquery picker, to format using the JS Date Format. I never thought to try PHP Date format and it worked. Maybe I don’t fully understand the documentation, but this is where some of my confusion lies. Anyway, the code seems to be pulling the correct date and formatting the way I configured it to.
Thank you for your help!
Kim
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.