Hi there,

I'm using Zend_Date to handle datetimes on my application.
What I do is set UTC as the default timezone, so I use a universal time zone 
for all my internal and persistence operations, and the I use our local 
timezone (Europe/Madrid) just to show dates on the web frontend.

My question is if is there a better solution to show dates than cloning the 
Zend_Date object so the original date's timezone is not changed.

What I mean is, if something like this:
class Event {
    /**
     * @var Zend_Date
     */
    protected $_endTime;

    public function getLocalEndTime()
    {
        $endTimeClone = clone($this->_endTime);
        $endTimeClone->setTimezone('Europe/Madrid');
        return $endTimeClone->toString('es_ES');
    }
}

could be replaced by something like this: (obviously toString method does not 
work on this way)
class Event {
    /**
     * @var Zend_Date
     */
    protected $_endTime;

    public function getLocalEndTime()
    {
        return $this->_endTime->toString('es_ES', 'Europe/Madrid');
    }
}

-- 
Alayn Gortazar

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to