This extension is a Widget that takes two dates and displays them in a human friendly string.
Here are some example outcomes
"2012-12-25" and "2012-12-31" will show as "25 to 31 Dec 2012" "2012-12-25" and "2013-01-15" will show as "25 Dec 2012 to 15 Jan 2013" "2013-01-05" and "2013-02-10" will show as "05 Jan to 10 Feb 2013"
Yii 1.1 or above
$this->widget('TimeString', array( 'startDate'=>$data->start_date, // assuming $data->start_date is "2012-12-25" 'endDate'=>$data->end_date, // assuming $data->end_date is "2012-12-31" 'duration'=>true, ));
Total 4 comments
I see,
thx for your response. how about convert this extension into helper function? so, i could make a special AR function on model, and then call that function from CGridView? just idea..
Hi Peter, I tried using the example I have written below but without luck. The page renders up to the point where the widget code is and then stops rendering any further. Did you have any further luck? In the following example, I used
instead of
as "widget" is not a method of CGridView.
Hi Peter, Thank you for your question. I haven't tried this in CGridView, but I will try it and come back to you.
is it working on CGridView?..
Leave a comment
Please login to leave your comment.