what_week()
what_week(as_integer = TRUE)
# Other dates/times:
d1 <- as.Date("2020-12-24")
what_week(when = d1, unit = "year")
what_week(when = d1, unit = "month")
what_week(Sys.time()) # with POSIXct time
# with date vector (as characters):
ds <- c("2020-01-01", "2020-02-29", "2020-12-24", "2020-12-31")
what_week(when = ds)
what_week(when = ds, unit = "month", as_integer = TRUE)
what_week(when = ds, unit = "year", as_integer = TRUE)
# with time vector (strings of POSIXct times):
ts <- c("2020-12-25 10:11:12 CET", "2020-12-31 23:59:59")
what_week(ts)
Run the code above in your browser using DataLab