x <- year_month_day(2019, 1:3, 5:7, 1, 20, 30)
get_month(x)
get_day(x)
get_second(x)
# Cannot extract more precise components
y <- year_month_day(2019, 1)
try(get_day(y))
# Cannot extract components that don't exist for this calendar
try(get_quarter(x))
Run the code above in your browser using DataLab