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

Treehouse gives an error for code that runs correctly.

Treehouse is asking me to print "Today is July 04, 2016" (or current date) to the screen. I have tried numerous (successful) ways of doing this but the error "you have not passed the correct string" keeps happening.

I have tried echo date('F d\, Y'); which prints correctly. I have tried concatenation: date('F d') . ', ' . date('Y'); which prints correctly. Ive even expanded it fully with: date('F') . ' ' . date('d') . ', ' . date('Y'); with no success. Assuming treehouse does not have bugs, what am I doing wrong?

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! You are correct in that it would echo the same thing. But Treehouse is judging this based on the string passed into the date function, and your string doesn't match what they're expecting. Also, there's no need to escape the comma. If you remove the \, your code passes!

Good luck! :sparkles: