Home › Forums › Add-ons › Repeater Field › Change Date format in Repeater Field › Reply To: Change Date format in Repeater Field
I would do this by setting my return value to be formatted as Y-m-d
and then I would format the date/time the way I want by using PHP function date() and strtotime(). The reason for setting the display to Y-m-d
is because this is a format that will not be confused when using strtotime()
$acf_date = get_field('my_date_field');
// format date
$date = date('l d F Y', strtotime($acf_date));
// OR
$date = date('F Y', strtotime($acf_date));
http://php.net/manual/en/function.strtotime.php
http://php.net/manual/en/function.date.php
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.