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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.