1

I have a ZF app and am saving times as UTC in MySQL db. When I retrieve, them I'd like to tell Zend_Ddate that they are UTC rather than the timezone set in php.ini of 'America/Los Angeles'.

Currently, I'm instantiating like this:

$date=new Zend_Date($item['created_on_utc'],Zend_Date::ISO_8601,'en_US');

but feel like there should be a way to tell Zend_Date that is a utc Date. How would I do that?

thanks

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
timpone
  • 19,235
  • 36
  • 121
  • 211

1 Answers1

1

try the following:

date_default_timezone_set — Sets the default timezone used by all date/time functions in a script

date_default_timezone_set('Etc/UTC');
Phil Rykoff
  • 11,999
  • 3
  • 39
  • 63
  • +1, this is best set in your bootstrap. In fact, with E_STRICT enabled, PHP will complain whenever you are using a time function relying on the timezone. – Gordon Mar 06 '10 at 22:03
  • this was already done index.php script. the issue is that I'm saving in UTC with locale associated with that save (in case user changes his / her locale at a future point). The issue is how do I decrement the 8 hrs from UTC to America / Los Angeles. It seems like I should be able to tell Zend_Date, you're getting UTC and I want it to be Pacific time zone – timpone Mar 07 '10 at 22:31