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 trialEthan Lax
782 PointsI'm trying to display the date, formatted as ex:(January 1, 2017) but I keep getting the error "use date('F')".
My input is <?php echo date('F') . ' ' . date('d') . ', ' . date('Y'); ?> I also tried, echo date('F d') . ', ' . date('Y'); and both display the date as required, but the error remains. Please help.
<?php
echo 'Today is ';
//Place your code below this comment
echo date('F') . ' ' . date('d') . ', ' . date('Y');
?>
1 Answer
Ryan S
27,276 PointsHi Ethan,
You can think of the input parameter of the date
function as the entire output of what you want your date to look like. So all you need to do is replace each part of the string with its corresponding letter, no string concatenation required.
echo date("F d, Y");
Hope this helps.
Ethan Lax
782 PointsEthan Lax
782 PointsThanks for the quick response!... I didn't know I could place the comma with the parameters, which is the only reason I used concatenation in the first place.