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 Build a Simple PHP Application Getting Started with PHP Your First PHP File

Joe Ainsworth
Joe Ainsworth
13,588 Points

PHP 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

If 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'); ?>

Oh, didn't see your answer. Excuse me.

A 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'); ?>

Take a look at Joakim's answer.

Master Marketing
Master Marketing
1,200 Points

How do you take credit for the extra credit by the way?

Joe Ainsworth
Joe Ainsworth
13,588 Points

I 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
Master Marketing
1,200 Points

Joe Ainsworth, ohh gotcha! I thought you can really get credited for it. I was wondering about that for a while now. Thanks! ^^