Jump to content

[SOLVED] Php date function wrong time


onenonly

Recommended Posts

Instead of using this function to set the default timezone in your script, you can also use the INI setting date.timezone to set the default timezone.

 

http://kb.siteground.com/article/How_to_change_the_datetimezone_value_in_PHP.html

 

If your PHP scripts do not show the correct time, the reason is that most probably your hosting server is in a different timezone. This can be easily resolved by changing a setting in PHP called date.timezone.

 

 

 

Depending on your location you can set a specific date.timezone value in PHP using the following option which should be added to your local php.ini file:

 

 

 

date.timezone = "US/Central"

 

 

 

The above example assumes you'd like to set the timezone for your PHP scripts to US/Central. The full list of supported time zones is available here and you should simply replace "US/Central" with the desired timezone.

Instead of using this function to set the default timezone in your script, you can also use the INI setting date.timezone to set the default timezone.

 

http://kb.siteground.com/article/How_to_change_the_datetimezone_value_in_PHP.html

 

If your PHP scripts do not show the correct time, the reason is that most probably your hosting server is in a different timezone. This can be easily resolved by changing a setting in PHP called date.timezone.

 

 

 

Depending on your location you can set a specific date.timezone value in PHP using the following option which should be added to your local php.ini file:

 

 

 

date.timezone = "US/Central"

 

 

 

The above example assumes you'd like to set the timezone for your PHP scripts to US/Central. The full list of supported time zones is available here and you should simply replace "US/Central" with the desired timezone.

 

 

 

do you do that once and its permanent? or you must put it on top of all your script?

If php is running as an Apache Module, you can put php settings into a .htaccess file. If php is running as a CGI application, you can put php settings into a local php.ini. Check with your web host which method is supported.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.