Getyear

how can I get the year of a field that contain a date??

my model name is "SuratKeluar" and the field name is "tanggal" and there is a field "tahun" and i want to fill it with the year of the "tanggal"

Here is an example using cgridview, you just change date format into year




array(

       	'name'=>'start_date',

       	'header'=>'Start Date',

       	'value'=>'date("Y",strtotime($data["start_date"]))'

),