The server that houses your hosting account is set to a specific time zone. This is either the Eastern Standard Time (EST) or Pacific Standard Time (PST) depending on whether your server is on the East Coast or West Coast of the US. Your site, however, may cater to a target market with a different time zone. In this case, you may want any times that display on your website to use that local time zone. Below are the instructions for using your .htaccess file to alter the default time zone for your site.
How to change your default timezone with the .htaccess file
- Log into your cPanel dashboard.
- Using the File Manager found in the Files category, be sure to show the hidden files and enter using root directory for the domain you are working with.
- Once in the proper folder, find the .htaccess file. You may have to create one if it does not yet exist. After finding or creating the file, you will need to open the file for editing.
- Now that you are in the editor, you will need to add the code for your desired time zone. In our example, we are setting the time zone to the New York time zone in the US.
#Alter the default time zone for the site
SetEnv TZ America/New_York
If you are unsure of the name or format of your desired time zone, you can check out our time zone list article.