This tutorial will show how to change PHP date.timezone on your site by using .htaccess file.
- Connect to your cPanel and go to File Manager.
- Then, go to public_html (or your website folder) and find .htaccess file. If you cannot find your .htaccess file, you can follow this guide.
- Then right-click on the file and select Edit.
- Enter the following code at the very top of your .htaccess code:
php_value date.timezone 'country/state'
- You can find time zones here.
- After adding your wanted zone, click Save Changes when you’re done.
How to check if changes are visible?
To check if the changes are visible and correct, you should follow these steps:
- Create a new phpinfo.php file on public_html directory or on your website folder.
- Then paste this code:
// Show all information, defaults to INFO_ALL
- Then, click on Save Changes.
- Open a new browser tab, go to your site, but add /phpinfo.php. It should look something like this:
Scroll down to find the date.timezone information table.