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 trialKohane Kagami
12,390 PointsWhat'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?
3 Answers
Matthew Carson
5,965 PointsTechnically 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");
?>
Mitch Maynard
12,953 PointsMy problem was that I had white space between the parameter I passed to the date function and the closing parenthesis.
Kohane Kagami
12,390 PointsThank you very much. :D
Nils Parres
11,321 PointsNils Parres
11,321 PointsHi, 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. ;)