Skip to contents

This function lets the user convert a date into YYYY-MM, YYYY-QX, or YYYY-WW format easily.

Usage

year_month(date)

year_quarter(date)

year_week(date)

Arguments

date

Date vector. Date to transform format.

Value

Vector with dates reformatted

Examples

year_month(Sys.Date())
#> [1] "2024-10"
year_quarter(Sys.Date())
#> [1] "2024-Q4"
year_week(Sys.Date())
#> [1] "2024-43"