Converts a date to its calendar (Gregorian) year, returned as a number.
Details
Unlike the ISO year (see date_to_isoyear_n()), the calendar year is taken
directly from the date, so 2021-01-01 is calendar year 2021.
See also
vignette("date_conversion", package = "cstime") for worked date,
ISO year and ISO week conversions. No vignette runs this function.
Other date-to-number converters:
date_to_calmonth_n(),
date_to_isoquarter_n(),
date_to_isoweek_n(),
date_to_isoyear_n()
Examples
date_to_calyear_n(as.Date("2021-08-11"))
#> [1] 2021
date_to_calyear_n("2021-01-01")
#> [1] 2021
