So if I retrive a date from a MySQL DB I have to do the following?

$date = new Zend_Date();
$date->setTimezone('UTC');
$date->set($dbRow->date, 'YYYY-MM-dd HH:mm:ss');
$created_at = new Zend_Measure_Time($date->getTimestamp());
$nowDate = new Zend_Date();
$nowDate->setTimezone('UTC');
$now = new Zend_Measure_Time($nowDate->getTimestamp());
$now->sub($created_at);
$now->convertTo(Zend_Measure_Time::SECOND);
...
...

I find it extremly heave.
I would expect something like this:

$date = new Zend_Date();
$date->setTimezone('UTC');
$date->set($dbRow->date, 'YYYY-MM-dd HH:mm:ss');
$nowDate = new Zend_Date();
$nowDate->setTimezone('UTC');

$timeSlice = $nowDate->subDate($nowDate);
$timeSlice->get('dd HH:mm:ss');

Саша Стаменковић a écrit :
Maybe this snippet can give you idea http://www.zfsnippets.com/snippets/view/id/39/time-measurement-with-zendmeasuretime

Regards,
Saša Stamenković


On Wed, Aug 12, 2009 at 2:11 PM, Mathieu Suen <mathieu.s...@easyflirt.com <mailto:mathieu.s...@easyflirt.com>> wrote:

    Hi,

    Using Zend_Date how could we get the difference between 2 date.
    Let's say I want the number of day?

    Thanks

-- -- Mathieu Suen
    --




--
-- Mathieu Suen
--

Reply via email to