Home › Forums › General Issues › Datepicker: wrong format is displaying › Reply To: Datepicker: wrong format is displaying
Sorry but I’m not having luck with getting the date formatting to work, referring to the datepicker documentation page.
http://www.advancedcustomfields.com/resources/field-types/date-picker/
Here’s my code:
if(get_field('deadline'))
{
echo '<li><strong>Deadline: </strong>' . get_field('deadline') . '</li>';
}
I was trying this but end up with a blank page:
if(get_field('deadline'))
{
$date = DateTime::createFromFormat('Ymd', get_field('deadline'));
echo '<li><strong>Deadline: </strong>' . $date->format('d-m-Y') . '</li>';
}
Thanks for any help!
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.