Jump to content

CruisePlus

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by CruisePlus

  1. The variable cruise_line and ship are output correctly if $departure_date->format('j M Y') is removed
  2. 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'); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.