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 trialZachary Sedefian
13,887 PointsCode looks correct but getting an error
<?php echo 'Today is '; //Place your code below this comment echo date('M d') . ', ' . date('Y'); ?>
Zachary Sedefian
13,887 PointsAfter 'Today is '? Yes.
4 Answers
sendi stephen
247 Pointsthis is how it should be friend! hope its what you wanted...
<?php /* will give the current year,month and date with a forward slash seperator*/ echo "Today is " . date("Y/m/d") . "<br>"; /* will give the current year,month and date with a full stop seperator*/ echo "Today is " . date("Y.m.d") . "<br>"; /* will give the current year,month and date with a colon seperator*/ echo "Today is " . date("Y-m-d") . "<br>"; /* will give the current day of the week*/ echo "Today is " . date("l"); ?>
Julien riera
14,665 PointsYou should have the whole thing written this way : "X y, Z". (I try not to give you the answer but my point is don't use concatenation). If I remember right.
Also, you should take a look at the documentation as I think you're using "M" for the full written month which is, once again if I remember it correctly, wrong. (I have F in mind)
Hope this help.
Ju
Edit : you might find this useful : http://php.net/manual/fr/function.date.php
Anna Cihlová
2,442 Pointsis there dot before - day ?
Julien riera
14,665 PointsThe dot is used for concatenation.
For instance :
<?php
$day = 'Wednesday';
echo 'Today is ' . $day;
?>
This should print out : "Today is Wednesday". It's the same here.
Anna Cihlová
2,442 Pointsooh. okay - thank you :)
Julien riera
14,665 PointsJulien riera
14,665 PointsDo you effectively have that first semicolon ?