Home › Forums › Backend Issues (wp-admin) › Error tying to format date › Reply To: Error tying to format date
Hi – I wonder whether you ever solved this issue. I have the same error. I have diagnosed that this only happens if the day value is greater than 12. Obviously this is a format issue but on the Event edit screen it shows correctly. If I set the date to say 12 July everything is cool but my code returns the 7th December. If I change it to 13 July it falls over – as there is no 13th month.
My WP general setting is set to GMT
The relevant code is:
<?php
$eventDate = new DateTime(get_Field(‘event_date’));
echo $eventDate->format(‘M’)
?></span>
<span class=”event-summary__day”><?php echo $eventDate->format(‘d’) ?>
Any help gratefully received
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.