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.
<?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
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.