Tuesday, September 8, 2009

PHP Dynamic Timezones Setting

Some queries work well in one timezone will effected in another timezones. Because timezones are varied from server to server. To overcome this problem you can set the default timezone for the site irrespective of the server time by using the below function.

date_default_timezone_set('Timezone')

here 'Timezone' is the string for example for setting Indian Standard Time it is "Asia/Calcutta", for Los Angels it is "America/Los_Angeles" etc

Ex: date_default_timezone_set('Asia/Calcutta')

Checkout the timezones list at php.net

0 comments: