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

Travis John Villanueva
Travis John Villanueva
5,052 Points

I answered it correctly

I answered it correctly and it shows that i didn't type the correct formatting

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

1 Answer

Joel Bardsley
Joel Bardsley
31,249 Points

Hi Travis,

Your usage of F d and Y is correct but the output isn't exactly as the challenge requested. As you've used a double space between F and d, this is represented in the output, as well as the space between the day and the comma.

Removing the extra spaces should pass the challenge, but it looks like escaping the comma still causes the task to fail. Looking at the examples in the date() documentation, shows that you don't have to escape the comma for this challenge (although I think the task should still pass with or without the escaping).

You're far from the only one that has experienced similar frustration with this particular challenge, but hopefully this has been of some help.

Travis John Villanueva
Travis John Villanueva
5,052 Points

Ok, but this doesn't work as well..

echo date("F d\, Y");

Joel Bardsley
Joel Bardsley
31,249 Points

No problem. As mentioned, escaping the comma causes the task to fail, so remove the backslash before the comma and it will pass.