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

The function i'm replying is correct but it isn't submiting.

Asked to add date in PHP in a SINGLE line and in a designated format, i did as it asked to but it doesn't let me pass the test.

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

5 Answers

Hello Geronimo.

You are very close. In php the left hand parentheses need to be touching the function name, ie with no spaces.

<?php
date('F d, Y');

Additionally, you are duplicating the Today is, so once you fix your function call, it will print Today is Today is September 20, 2018, instead of Today is September 20, 2018. I would remove the "Today is" and just echo the date.

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

Remove the space between date and ('F d, Y') . The following should pass:

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

In the challenge click preview and check the results

Hi Kris. Already did, in the code that got here i know i repeated the echo for 'Today is ' but if i take it away is still the same. It keeps saying "Bummer: You must use the built-in date function".

Thanks Kris and Spencer, that did the job.