Home › Forums › General Issues › Difficulties to sort a post by DatePicker › Reply To: Difficulties to sort a post by DatePicker
Hi John,
Thanks for your help again !
The value returned for the
echo get_field('end_date', false, false);
is the end date that I fill in the backend and with this code it gives me the date at this format : 2016-10-21 15:00:00 (for the first event), 2017-07-15 17:30:00 (for the second event)…
For the second one :
$date_one_timestamp = strtotime(get_field('end_date', false, false));
echo $date_one_timestamp;
It gives some weird numbers like 1477062000 or 1500139800
And the third one :
echo (date('Y-m-d H:i:s', $date_one_timestamp));
It gives me exactly the same than the first one, it’s the value of the end_date field like : 2016-12-23 22:00:00
The 1970-01-01 00:00:00 is the value by default if the field is not filled.
I’ll continue to search what’s wrong in my code.
Thanks a lot John !
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.