
Date to calendar yearmonth (character)
Source:R/conversion_date_calmonth_calyear.R
date_to_calyearmonth_c.RdConverts a date to a combined calendar year and month string of the form "yyyy-Mmm".
Details
The output combines the calendar year and the zero-padded calendar month, separated by "-M", for example "2021-M08".
See also
vignette("date_conversion", package = "cstime") for worked date,
ISO year and ISO week conversions. No vignette runs this function.
Other date-to-character converters:
date_to_calmonth_c(),
date_to_calyear_c(),
date_to_isoquarter_c(),
date_to_isoweek_c(),
date_to_isoyear_c(),
date_to_isoyearquarter_c(),
date_to_isoyearweek_c()
Examples
date_to_calyearmonth_c(as.Date("2021-08-11"))
#> [1] "2021-M08"
date_to_calyearmonth_c("2021-01-01")
#> [1] "2021-M01"