Find the difference from GMT of a DATETIME

I have a datetime class.

How can I find the difference from GMT (This GMT+2 that we say )?

$time= new DateTime($item['ac_final_date']);        

echo   $time->format("d/m/y H:i:s");

Hm, are you looking for DateTime::diff()?

I believe it’s ‘z’

And it can be used like:

z = short format

zz = medium -"-

zzz = long -"-

hi i am trying to show in a custom column grid that shows me the remains of two of the fields grid, and what would they be fecha_det_a1 fecha_ocu_a1

this function should develop in my admin because that’s where I want it to display. Already declared the variable in the model (), now this is the function:


function dateDiff($start, $end)


$start_ts = strtotime($start);

$end_ts = strtotime($end);

$diff = $end_ts - $start_ts;

return round($diff / 86400);




When I invoke the function within the grid, I do soÑ

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(


‘itemsCssClass’=>“table table-striped”,


















)); ?>

but when I go to access the admin view returns me the following error:

call_user_func_array() expects parameter 1 to be a valid callback, no array or string given

could you help me? thanks