setting default time zone for php script

3:09 AM

(0) Comments

there is many situations that you need to set the default timezone before you use date or time function such as date()
for example if your script user not in the country that you have the server or hosting on and you want to record lastlogin time , yes you are in trouble
there is many ways to do that


you can modify the .htaccess

php_value date.timezone America/New_York

but notice you must have php5 enabled in the server so you can use this
another one that i prefer is from your script not from htaccess
you can add this line in your php script before you use any date/time functions

date_default_timezone_set('America/New_York');

so you can modify default time zone in php use htaccess or php funciton date_default_timezone_set
enjoy :)

eslam

0 Responses to "setting default time zone for php script"

Post a Comment