Support

Account

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!