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:

    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!