rip_hour() extracts the hour from a date or datetime object.
rip_hour(x)
| x |
The vector to extract the hour from. |
|---|
An integer vector the same size as x containing the hours.
# Identical dates, but in different hours x <- as.POSIXct("1969-12-31 19:00:00", tz = "America/New_York") y <- as.POSIXct("1970-01-01 00:00:00", tz = "UTC") identical(as.numeric(x), as.numeric(y))#> [1] TRUErip_hour(x)#> [1] 19rip_hour(y)#> [1] 0