Hello there,
This is an old issue, but surprisingly the last version of lubridate does not seem to handle this very well.
Consider this simple example
dataframe <- tibble(gmt_time = c('2016-07-08 04:30:10.690'), value = c(1))
library(hms)
library(lubridate)
dataframe %>%
mutate(gmt_time = ymd_hms(gmt_time),
est_time = with_tz(gmt_time, 'America/New_York'),
myhour1 = as.hms(est_time),
myhour2 = as.hms(gmt_time))
# A tibble: 1 x 5
gmt_time value est_time myhour1 myhour2
<dttm> <dbl> <dttm> <time> <time>
1 2016-07-08 04:30:10.690 1 2016-07-08 00:30:10.690 30'10.690000" 30'10.690000"
What is going on here? I would like to extract the time component of the timestamp, so that I can run filters like time > 04:30:00
Thanks!