In one of my recent projects, we were building a web application that was reliant on our servers timezone. The app was designed to receive a request and timeout if the request was not responded to within a certain timeframe. We are working in Mountain time so we needed the server to match.

Editing the .htaccess file.

You can usually find your .htaccess file in the root folder of your server. If there isn’t one there you can create it and apply the permissions of 644. (Owner – Read/Write, Group – Read, Public -Read)

Edit the file adding the time zone.

SetEnv TZ America/Denver

These are additional time zones available for our region.

America/New_York // Eastern Time 
America/Detroit // Eastern Time - Michigan (most locations) 
America/Louisville // Eastern Time (Louisville, Kentucky) 
America/Indianapolis // Eastern Standard Time (Indiana, most locations) 
America/Indiana/Marengo // Eastern Standard Time (Indiana, Crawford County) 
America/Indiana/Knox // Eastern Standard Time (Indiana, Starke County) 
America/Indiana/Vevay // Eastern Standard Time (Indiana, Switzerland County) 
America/Chicago // Central Time 
America/Menominee // Central Time (Michigan, Wisconsin border) 
America/Denver // Mountain Time 
America/Boise // Mountain Time (South Idaho, East Oregon) 
America/Shiprock // Mountain Time (Navajo) 
America/Phoenix // Mountain Standard Time (Arizona) 
America/Los_Angeles // Pacific Time 
America/Anchorage // Alaska Time 
America/Juneau // Alaska Time (Alaska panhandle) 
America/Yakutat // Alaska Time (Alaska panhandle neck) 
America/Nome // Alaska Time (west Alaska) 
America/Adak // Aleutian Islands 
Pacific/Honolulu // Hawaii

Note that the // is just for the comment referencing the time zone.


Hopefully, this helps you in your next project. It’s pretty straight forward and can save you time over using a php.ini file or something to that nature.

Let me know if you have any questions or want to share an example in the comments section below.

Leave comment

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