Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics PHP on the Web Date Function

Andrew Basore
PLUS
Andrew Basore
Courses Plus Student 6,196 Points

Output matches expected value, but still says is wrong.

I'm not sure what's wrong. The preview result matches what the error says it should output.

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

echo date('F d\, Y.');
?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Close, but not quite. And I mean really really close here. First, you have a full stop at the end which wasn't asked for by the challenge. Secondly, the challenge is checking the string passed into the date function. Here, you're escaping the comma, which is unnecessary so it doesn't know to expect that.

Bummer: You have not passed the correct string for formatting. Your date SHOULD return: May 11, 2018

So your string has an extra period/full stop and an extra escape character \ which aren't expected.

You sent in the string: 'F d\, Y.

But it was expecting the string: F d, Y

Note the removal of the . and \ from the latter version.

Hope this helps! :sparkles: