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

Are this question required the output like Month date, and Year?

I did look through the documentation through the link given and I did try on my local server as well. It looks fine in my local server and output exactly same like what the question expected. But I wondering what's the problem with the code?? How come I couldnt pass this question and keep asking me "You forget the echo command?" What is the meaning of this?

index.php
<?php
//Place your code below this comment
echo "Today is " . date("F j, Y");

?>

1 Answer

Jasper Bloem
Jasper Bloem
22,424 Points

Hey WK h,

You didn't use the right format character for the day. 'j' will display the current day of the month without leading zeros. That means that you'll display '4' instead of '04'. 'd' is the right format character in this case. So your code actually works, but the challenge won't accept it in that way.

This is the right answer:

<?php
echo 'Today is ';
//Place your code below this comment

echo date("F d, Y");

?>

Good luck coding!

Hi, Jasper Bloem, Well, this is my stupid mistake, thanks for pointing out the error, definitely will look carefully next time. Again, thank you!