Home
/
Website Help
/
PHP Questions
/
How to change the timezone for a single PHP file?

How to change the timezone for a single PHP file?

To set a specific timezone for a PHP script, use the following function which should be added to the PHP file:

putenv("TZ=US/Central");

This is just an example. The full list of supported timezones is available here. Replace “US/Central” with the desired timezone.

To change the PHP timezone per-folder, check this article for information on how to do it.

Share This Article