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:

    $eventDate = new DateTime(get_Field(‘event_date’));
    echo $eventDate->format(‘M’)
    <span class=”event-summary__day”><?php echo $eventDate->format(‘d’) ?>

    Any help gratefully received