Websterz Technology Blog

Free tutorials, Tech News, Source codes, Tweaks and Tips.

Here is short code that changes the timezone for the linux server, you can add this single line of code into your .htaccess file to change the timezone/locale for your PHP files.

Follow the below steps:

Add the following code into .htaccess file and upload it to the server:

php_value date.timezone “America/New_York”

Now check the changes by adding following code into your PHP file:

echo date(‘h:s d-m-y’);

It will display your current time according to the timezone you have mentioned in the .htaccess file.

Here is the list of all supported locales/timezones for PHP:



Thats all.

Spread the love
See also  How to deal with hackers for web server? Sym links solution

Leave a Reply

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