Zend_Date and Zend Locale; can't get it to work ><

Posted by Rick de Graaf on Stack Overflow See other posts from Stack Overflow or by Rick de Graaf
Published on 2010-04-23T13:24:42Z Indexed on 2010/04/23 13:33 UTC
Read the original article Hit count: 282

Loving Zend Framework, hating Zend_Date...

I'm buidling an app where one of the functions is to track the time one spends on a certain task. This works great. My previous question was my incapability to get the sum of all the timestamps (time spent on each task). Well that works as a charm, but when I echo this value, it adds one hour. Using gmdate() (just for checking) and the value turns out exactly as it's supposed to. I thought to solve this problem easeliy with Zend_Local, but I can't get the damn thing to work!

This is my bootstrap code:

protected function _initLocale()
{
    $locale = new Zend_Locale('nl_NL');
    $locale->setLocale($locale);
    Zend_Registry::set('Zend_Locale', $locale);
} 

This is the code in my view file:

$date = new Zend_Date($this->timequery, null, $locale); echo $date->toString(Zend_Date::HOUR.':'.Zend_Date::MINUTE.':'.Zend_Date::SECOND);

The timestamp I'm processing is: 2632 which equals 00:43:52. The output I get is: 01:43:52

I know the extra hour comes from the time difference, but I can seem to solve this with Zend_Local and Zend_Date.

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-date