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

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: