How do I set the timezone for my PHP application? Print

  • 39

In orde to make your PHP (symfony and Zend Framework too) application aware of your time zone, set the date.timezone php configuration variable in a .htaccess file, like this:

.htaccess contents:

php_value date.timezone America/New_York

From Plesk, you can create and edit this file from the File Manager located inside your domain section.

You can verify the change by creating a PHP script with the following content:

<?php echo date('Y-m-d H:i:s e' );

Which will print the time and the time zone.

 


Was this answer helpful?

« Back