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 Basics PHP on the Web Date Function

What's wrong with my code?

Here is the problem. "For this code challenge, you'll need to check out the documentation for the date function to see details about formatting. Use the date function to add todays date to the display message in the following format: full month, day of the month with leading 0, comma and 4 digit year. Example: Today is July 04, 2016"

and here is my code:

<?php
echo 'Today is '. date("F d, Y");
?>

What's wrong with my code?
Nils Parres
Nils Parres
11,321 Points

Hi, try to change the single qoutes to double quotes, like this:

change your code from ' Today is ' .date("F d, Y");

to this "Today is " .date("F d, Y");

than it should work. ;)

3 Answers

Matthew Carson
Matthew Carson
5,965 Points

Technically your code would work in real life, but the challenge wants you to put something specific in.

It wants you to type this:

<?php
echo 'Today is ';
//Place your code below this comment
echo date("F d, Y");
?>

My problem was that I had white space between the parameter I passed to the date function and the closing parenthesis.

Thank you very much. :D