Home Forums Front-end Issues Date output Reply To: Date output

  • Hi,

    I am new to WordPress and PHP and got stuck while using ACF.

    I want to use a custom date field for my event section.

    And on the front-end I only want to show the 3 letter of the month and nothing else but it won’t work. Please find below what I am writing in PHP.

    $eventDate = new DateTime(get_field(‘event_date’));
    echo $eventDate->format(‘M’)

    the error I am getting is…

    Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (26/09/2019) at position 0 (2): Unexpected character in /app/public/wp-content/themes/fictional-university-theme/front-page.php:30