Converts a date to its ISO 8601 week-based year, returned as a character string.
Details
The ISO 8601 week-based year is not always the same as the calendar year. ISO weeks run Monday to Sunday. Week 1 is the week that contains the first Thursday of the year. As a result, the first days of January can belong to the last ISO week of the previous year. The last days of December can belong to ISO week 1 of the following year. For example, 2021-01-01 is a Friday that falls in ISO week 53 of ISO year 2020.
See also
vignette("cstime", package = "cstime") and
vignette("date_conversion", package = "cstime"), which both run this
function.
Other date-to-character converters:
date_to_calmonth_c(),
date_to_calyear_c(),
date_to_calyearmonth_c(),
date_to_isoquarter_c(),
date_to_isoweek_c(),
date_to_isoyearquarter_c(),
date_to_isoyearweek_c()
Examples
date_to_isoyear_c(as.Date("2021-08-11"))
#> [1] "2021"
date_to_isoyear_c("2021-01-01")
#> [1] "2020"
