If you use the PHP5.3 version above, the PHP date function error will occur if you do not have the correct configuration php.ini. A lot of old PHP programming tutorials did not mention this problem, so many readers will feel puzzled, the following author for you to solve this problem three ways.
"PHP Warning:
Date () [Function.date]: It is isn't safe to rely on the system ' s timezone settings.
You are are *required* to use the date.
TimeZone setting or the Date_default_timezone_set () function.
In case you are used any of those methods and your are still getting this warning,
You most likely misspelled the timezone identifier.
We selected ' UTC ' for ' 8.0/no DST ' instead in '
In fact, from PHP 5.1.0, when a function such as the date () is used, a e_notice or e_warning information is generated when the timezone is set incorrectly and every time function is invoked. And in the PHP 5.1.0, date.timezone This option, by default is closed, no matter what PHP command is Greenwich Standard Time, but PHP 5.3 as if there is no setting will be forced to throw this error, to solve this problem, as long as localized on the line.
First , in the page using Date_default_timezone_set () Set Date_default_timezone_set (' PRC '); East Eight time zone echo
Date (' y-m-d h:i:s ');
Second, the use of Ini_set (' Date.timezone ', ' Asia/shanghai ') in the head of the page;
Third, modify PHP.ini (if it is Windows system, then file in C disk, Windows directory, if the system is installed in C disk). Use Notepad to open php.ini find date.timezone Remove the preceding semicolon modify to become: Date.timezone = PRC
Restart the HTTP service (such as Apache2 or IIS)!
One of the above three methods can be selected, the small series recommend the use of a third method, do not need to add additional code each time.