Hi,
Not sure if you can help with this. I’m trying to have a custom field for posts, to have the date field I’m using the ACF that comes with X, I’m trying to reference that fields as below:
<?php
$event_date = new DateTime(get_field('event_date'));
echo $event_date->format('M')
?>
When I’m not referencing the get_field('event_date')
it just work fine to show the current date as per PHP function DateTime();
when I do reference it I’m getting the following error.
: Uncaught Exception: DateTime::__construct(): Failed to parse time string (31/12/2018) at position 0 (3): Unexpected character in /Applications/MAMP/htdocs/cs-dev/wp-content/themes/fictional-university-theme/front-page.php:31
Stack trace:
/Applications/MAMP/htdocs/cs-dev/wp-content/themes/fictional-university-theme/front-page.php(31): DateTime->__construct('31/12/2018')
/Applications/MAMP/htdocs/cs-dev/wp-includes/template-loader.php(74): include('/Applications/M...')
/Applications/MAMP/htdocs/cs-dev/wp-blog-header.php(19): require_once('/Applications/M...')
/Applications/MAMP/htdocs/cs-dev/index.php(17): require('/Applications/M...')
{main}
thrown in
How can I just make it work the get_field();
to show them on FE?
Thanks in advance!