I am using the formatting 'value'=>'date("M j, Y", $data->create_time)'. I have a value in create_time, but when I use the expression, it is zero (i.e., expression returns Dec, 12 1969).
The formatting code for this is right out of http://www.yiiframew...i/1.1/CGridView
For now, to remove the time stamp I used substr. But with this, I cannot format the date. Here's my code (the commented out data expression is what is not working:
'columns'=>array(
'id',
'title',
array('header' => 'date',
'value' => 'substr($data->create_time,0,10)'), //'date("M j, Y", $data->create_time)'),
Any ideas? Is this working for anyone else?
Page 1 of 1
CGridView create_time formatting 'value'=>'date("M j, Y", $data->creat
#2
Posted 29 July 2012 - 12:05 AM
I had a problem with this also.. didn't have time to debug, so I just created a method and used it:
*Edit - I just tested this and whatever problem I had has gone away.
'value' => 'MyModel::model()->displayDate($data->create_time)',
*Edit - I just tested this and whatever problem I had has gone away.
#3
Posted 29 July 2012 - 05:59 AM
Hello
I don't get it. You say create_time is a timestamp? Like a Unix one: '1343392756', or a date: '2012-07-29'?
I don't get it. You say create_time is a timestamp? Like a Unix one: '1343392756', or a date: '2012-07-29'?
#4
Posted 30 July 2012 - 12:08 AM
Share this topic:
Page 1 of 1

Help














