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 Daily Exercise Program Daily Exercise Program

Chris Sederqvist
Chris Sederqvist
7,596 Points

Should not use date()

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.

2 Answers

Nathan Gallagher
Nathan Gallagher
21,518 Points

It wants you to declare a timezone.

Example that worked for me:

$day = date('N');

Here's a list of supported Timezones: http://php.net/manual/en/timezones.php

Bozhong Tao
Bozhong Tao
18,365 Points

Thanks so much for the prompt! :)

Wonder why It keeps getting the wrong date int for me.