Tuesday, 6 August 2013

Change TimeZone With .htaccess

Filled under:

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:

http://php.net/manual/en/timezones.php

0 comments:

Post a Comment