Help with converting time zone using Pear Date
Posted: Wed Jun 04, 2008 3:41 pm
Hello, I'm trying to do what should be a very simple Time Zone conversion using Pear's Date package. The code I'm using is straight from the Pear docs but it's not quite working for me and I'm hoping someone could have a look and tell me where I'm going wrong please
As you can see, it's able to get the correct time from the server, but then when it converts it's behind by 6 hours. Any ideas what might be happening?
Thanks kindly
Code: Select all
$now = date Date();
echo $now->getDate(); // 2008-06-04 15:26:00
$timezone = new Date_TimeZone('PST');
$now->convertTZ($timezone);
echo $now->getDate(); // 2008-06-04 07:26:00, should be 2008-06-04 13:26:00Thanks kindly