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 Let PHP Do the Work

Zachary Sedefian
Zachary Sedefian
13,887 Points

Code looks correct but getting an error

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

Julien riera
Julien riera
14,665 Points

Do you effectively have that first semicolon ?

4 Answers

this 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
Julien riera
14,665 Points

You 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á
Anna Cihlová
2,442 Points

is there dot before - day ?

Julien riera
Julien riera
14,665 Points

The 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á
Anna Cihlová
2,442 Points

ooh. okay - thank you :)