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.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.