difftime between days not woking

I can't seem to make this not work...

s_t1 <- "2020-07-24 23:56:30"
s_t2 <- "2020-07-25 00:20:17"

l_t1 <- as.POSIXlt(s_t1)
l_t2 <- as.POSIXlt(s_t2)
difftime(l_t2,l_t1,units = "hours")
# Time difference of 0.3963889 hours
c_t1 <- as.POSIXct(s_t1)
c_t2 <- as.POSIXct(s_t2)
difftime(c_t2,c_t1,units = "hours")
#Time difference of 0.3963889 hours

perhaps to help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

1 Like