PHP default time setting

Today I noticed that the date indicated by PHP is incorrect.

When I went into the PHP file to try to change the time zone, I get a big ugly warning that you need to set the time zone.

I do not get an error when the time zone is set to UTC, but the date is incorrect.

Every value other than UTC causes an error.

What is it?

+5
source share
1 answer
date.timezone = "Europe/Paris"

Put this in your php.ini file with the appropriate time zone from here , and then restart your HTTP server.

If you do not want to install it globally, but want to install it based on script -by-script, use this code on every page where the date / time function is used:

date_default_timezone_set('America/Los_Angeles');

Like the global time zone, select your time zone from here .

+8
source

All Articles