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 Basic PHP Website (2018) Building a Media Library in PHP Including the Footer and Adding Additional Pages

Error with footer.php date object ??

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

No idea what they mean should i use another method ?

2 Answers

You can try default date function and it work just fine even in our localhost.

<?php echo date("Y");?>
Bob McCarty
PLUS
Bob McCarty
Courses Plus Student 16,618 Points

Jens,

I don't have enough context to provide an answer. I have the following working.

<footer>
        <p>&copy; <?php bloginfo('name'); echo ' '; echo date('Y'); ?></p>
</footer>

Bob

Mmmh i think this is wrong :-(

<?php date_default_timezone_set('UTC');  echo date('jS \of F Y h:i:s A'); ?>

worked.

The date(); method seems to be not allowed without "default", but thanks.