Skip to main content
All CollectionsPHPPHP Advanced
How to Change the PHP Timezone Setting for Your Website
How to Change the PHP Timezone Setting for Your Website

Setting a different timezone with hPanel and PHP function

Updated over a week ago

While your server's global time configuration cannot be changed, you still can set the timezone for your website using hPanel or the PHP function:

Setting up Timezone via hPanel

Open Websites → Manage PHP Configuration page. There, open the PHP options tab and edit the date.timezone value:

If you are not sure which time zone to insert, check the Time Zone Map.

Save the changes at the bottom of the page, and the timezone will be updated 🚀

Setting up Timezone via PHP Function

As an alternative, you can set the timezone using the date_default_timezone_set PHP function. Just check the List of Supported Timezones, find the one which you need, and insert the following code to your website (in most cases, on your index.php file):

<?php
date_default_timezone_set("Asia/Bangkok");
echo date_default_timezone_get();
?>

Replacing "Asia/Bangkok" with the desired timezone.

Additional Resources

Did this answer your question?