These are year-month-weekday methods for the getter generics.
get_year()
returns the Gregorian year.get_month()
returns the month of the year.get_day()
returns the day of the week encoded from 1-7, where 1 = Sunday and 7 = Saturday.get_index()
returns a value from 1-5 indicating that the corresponding weekday is the n-th instance of that weekday in the current month.There are sub-daily getters for extracting more precise components.
Usage
# S3 method for class 'clock_year_month_weekday'
get_year(x)
# S3 method for class 'clock_year_month_weekday'
get_month(x)
# S3 method for class 'clock_year_month_weekday'
get_day(x)
# S3 method for class 'clock_year_month_weekday'
get_index(x)
# S3 method for class 'clock_year_month_weekday'
get_hour(x)
# S3 method for class 'clock_year_month_weekday'
get_minute(x)
# S3 method for class 'clock_year_month_weekday'
get_second(x)
# S3 method for class 'clock_year_month_weekday'
get_millisecond(x)
# S3 method for class 'clock_year_month_weekday'
get_microsecond(x)
# S3 method for class 'clock_year_month_weekday'
get_nanosecond(x)
Examples
monday <- clock_weekdays$monday
thursday <- clock_weekdays$thursday
x <- year_month_weekday(2019, 1, monday:thursday, 1:4)
x
#> <year_month_weekday<day>[4]>
#> [1] "2019-01-Mon[1]" "2019-01-Tue[2]" "2019-01-Wed[3]" "2019-01-Thu[4]"
# Gets the weekday, 1 = Sunday, 7 = Saturday
get_day(x)
#> [1] 2 3 4 5
# Gets the index indicating which instance of that particular weekday
# it is in the current month (i.e. the "1st Monday of January, 2019")
get_index(x)
#> [1] 1 2 3 4