You can do this in two ways,
1 - Define the date filed in the related model
as,
public function getDates()
{
//define the datetime table column names as below in an array, and you will get the
//carbon objects for these fields in model objects.
return array('created_at', 'updated_at', 'date_time_field');
}
then laravel return a carbon object for these columns, so that you can use like $time->year
.
2- You can create a carbon object and get the year as in Moppo's answer
Carbon::createFromFormat('Y-m-d H:i:s', $time)->year
First one make so clean for me, you can decide which way suits you.