Hi All,
I’m running WP 4.3.1 and ACF Version 5.3.1
I have a reverse relationship returning entries of which all other fields are working as expected. However, I have a date picker ACF with the following settings:
Display format: November 3, 2015
Return format: November 3, 2015
Here’s what I’m doing:
$dl_date = new DateTime( get_field('dl_date') );
echo $dl_date ->format('F d Y');
This keeps returning today’s date of every single entry regardless of what date I pick. I’ve used the date picker with the same display and output settings on several other CTPs, so I’m wondering if it has something to do with the reverse relationship? Thoughts?
I’ve also tried this method (strtotime) explained here with the same results. Every entry returns today’s date in the applied format:
http://support.advancedcustomfields.com/forums/topic/format-datetime/
i would use return format: Ymd
(better for ordering and strtotime)
and than use:
setlocale(LC_TIME, 'de_DE', 'de_DE.UTF-8'); //change to language you wish to display
$dl_date = get_field('dl_date'); //is $dl_date filled correct? or is it empty?
$dl_date = (strtotime($dl_date));
$dl_date_pretty = date_i18n( 'F d Y', $dl_date); //here you can change display of date format
//with help of date_i18n you can use setlocale to display a date with language you wish
echo $dl_date_pretty;