date_default_timezone_set function not working
Posted: Fri Mar 13, 2009 10:43 am
I am attempting to use the date_default_timezone_set function to override my web host's default timezone setting so that when I use the date function it returns a date that is correct for a specified timezone. However, this function is not working. I ran these two tests:
In both tests, the output is the same: EST5EDT 2009-03-13 11:35.
EST5EDT is the default timezone set by my web host. The PHP version is 5.2.6.
Can anyone explain to me why date_default_timezone_set() is not working?
Thanks,
Drew
Code: Select all
Test One
date_default_timezone_set(America/New_York);
$timezone=date_default_timezone_get();
$date=date('Y-m-d H:i:');
echo
"$timezone $date"
;
Code: Select all
Test Two
date_default_timezone_set(America/Los_Angeles);
$timezone=date_default_timezone_get();
$date=date('Y-m-d H:i:');
echo
"$timezone $date"
;
EST5EDT is the default timezone set by my web host. The PHP version is 5.2.6.
Can anyone explain to me why date_default_timezone_set() is not working?
Thanks,
Drew