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

Dean Barnett
Dean Barnett
570 Points

Why does: echo date ('F d\, Y'); not achieve the correct result but when i check it, the output matches the requirement?

I am having trouble understanding what is required as the code I put in matches the required output when run.

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

the requirement is to have an output which says

Today is April 08, 2025

Which is todays date of writing this, When I run the code that is what is displayed but when I check the result it is incorrect.

1 Answer

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,862 Points

Looks like the issue in your code is with the escaped comma (\,). In PHP's date() function, commas do not need to be escaped.