You are *required* to use the date.timezone setting in php date function

When you try to use date function in php and if it gives you the following issue:
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…….

It’s probably the configuration issue in php.ini file. If you have multiple versions of php installed and didn’t know which one you are using. Create a page with only


and load the page, search for php.ini and it will tell you where you php.ini file is.

NOW, to FIX the date() function issue, open the php.ini file, search for
;date.timezone =

and change it to
date.timezone = “America/New_York”

Save the file, restart your server and then you should be able to use the date() function without any issue.

If you see warning date(): Invalid date.timezone value “America/New_York” after you added the date.timezone in the php.ini file, then add this to your .bash_profile file
export TZ=”America/New_York”

List of php supported timezone

Search within Codexpedia

Custom Search

Search the entire web

Custom Search