Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

PHP - Date Formatting

I am working on my own little project but I'm doing something wrong. First week of PHP :)

$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');

}
Sue Dough
Sue Dough
35,800 Points

Check your error log and post the error. Also turn wp debug to true in your wp-config.php file. Then post the errors here so it will be easier to help you if you don't figure it out yourself.

put

define( 'WP_DEBUG', true );

in your wp config file.

https://codex.wordpress.org/WP_DEBUG

If your running apache you can view your error log like this:

tail -f /var/log/apache2/error.log

1 Answer

Thank you! I'll let you know if I cannot figure it out after looking at the error