as_year function

Convert a date into a year