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 trialJoe Ainsworth
13,588 PointsPHP Extra Credit - Code Challenge to display date
Extra credit challenge as below
Complete the previous code challenge again, but this time add a paragraph below the headline that displays the current date in a format like this:
Today is Wednesday, October 21, 2015.
The closest I could get was this..
Today is <?php echo date('D, M j, Y'); ?>.
Which output..
Today is Sat, Jan 3, 2015.
I viewed the php date manual but couldn't work out how to show more than 3 characters of the day and month.
3 Answers
jne
12,613 PointsIf you take a look at the php manual again the answer is there (http://php.net/manual/en/function.date.php)
Today is <?php echo date('l, F j, Y'); ?>
Philip G
14,600 PointsA simple look at the documentation helps :) http://php.net/manual/en/function.date.php
A lowercase l (L) should work.
Today is <?php echo date('l, M j, Y'); ?>
Philip G
14,600 PointsTake a look at Joakim's answer.
Master Marketing
1,200 PointsHow do you take credit for the extra credit by the way?
Joe Ainsworth
13,588 PointsI don't think you can claim credit. It's just an extra exercise you can choose to do. It usually requires you to use everything you've learnt to earn the badge.
Master Marketing
1,200 PointsJoe Ainsworth, ohh gotcha! I thought you can really get credited for it. I was wondering about that for a while now. Thanks! ^^
Philip G
14,600 PointsPhilip G
14,600 PointsOh, didn't see your answer. Excuse me.