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");
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:
<?php
function dateDiff($start, $end)
{
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
$fdfo=dateDiff($model->fecha_det_a1,$model->fecha_ocu_a1);
?>
When I invoke the function within the grid, I do soÑ
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
‘id’=>‘anexo1-grid’,
‘itemsCssClass’=>“table table-striped”,
‘dataProvider’=>$model->search(),
.
.
‘columns’=>array(
‘id’,
array(‘name’=>‘no_hc_a1’,‘value’=>’$data->no_hc_a1’),
array(‘name’=>‘entidadhc_fk’,‘value’=>’$data->entidadhcFk->enthc_nombre’),
array(‘name’=>‘orga_hc_siglas’,‘value’=>’$data->entidadhcFk->orgaFk->orga_hc_siglas’),
.
.
array(‘name’=>‘fdfo’,‘value’=>$fdfo),
.
.
array(
‘class’=>‘CButtonColumn’,
),
),
)); ?>
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