Press "Enter" to skip to content

How to set the Timezone in PHP

If you have your own VPS server, you can change the timezone either by httpd.conf or changing the timezone file on the SSH terminal. However, if you are on a shared hosting, you would have no access to either of them. But of course, you can still change timezone on the script level, thanks to the putenv variable.


Just change the TZ variable to your preferred timezone. You can check PHP.NET official website for the list of supported timezones.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *