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

Is my code wrong or is there something wrong with the excercise?

In the PHP basics challenge task about using the Date function I seem to be stuck.

The error message I get states the formatting string ins't correct. However the display page shows that my code displays the date just like the excercise shows it. Trying to change the string has only shown me 2 errors: 1) format of string incorrect or 2) use the built in date function.

I did look up the diffrent formatting parameters on the PHP doc page and it seems like my code is correct. So I ask the question: Is my code wrong, or is it the excercise?

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

1 Answer

adamdonatello
adamdonatello
27,485 Points

Hi Chris,

Technically your answer is correct.

It's just that the format of the date string you've provided isn't exactly how the challenge wants it. You just need to move the comma:

echo date('F d, Y');

Hope this helps!