Hi All! This is my second week of PHP. I'm going through a PHP course at the moment so i'm pretty certain i've made a stupid mistake somewhere!
I'm trying to get a date that's entered in my CMS panel to show on the front-end.
I've defined the variable departure_date --> got the raw data --> created a new date object --> tried to display the date object in the format j M Y.
I believe there is something wrong with how i am defining the date object in my echo statement.
I forgot to mention this is a wordpress website i'm working on with ACF custom fields if that helps.
$departure_date = get_field('departure_date', false, false);
$departure_date = new DateTime($departure_date);
$cruise_line = get_field('cruise_line');
$ship = get_field('ship');
if(get_field('ship'))
{
echo 'Departs' . $departure_date->format('j M Y') . get_field('cruise_line') . ' | ' . get_field('ship');
}