Get Year, Quarter, Month or Isoweek

get_year(x)

get_quarter(x)

get_month(x)

get_isoweek(x)

get_isoyear(x)

Arguments

x

a date_xx or any R object that can be coerced to POSIXlt

Value

an integer vector.

Details

If you use lubridate in addition to dint, you can also use lubridate::year(), lubridate::month() and lubridate::quarter() with dint objects.

See also

Examples

x <- date_yq(2016, 2) get_year(x)
#> [1] 2016
if (FALSE) { library(lubridate) year(x) } x <- date_yq(2016, 2) get_quarter(x)
#> [1] 2
if (FALSE) { library(lubridate) quarter(x) } x <- date_yq(2016, 2) get_month(x)
#> [1] 4
if (FALSE) { library(lubridate) month(x) } x <- date_yw(2016, 2) get_isoweek(x)
#> [1] 2
get_isoyear(as.Date("2018-01-01"))
#> [1] 2018
get_isoyear(as.Date("2016-01-01"))
#> [1] 2015