Open EdsterShih opened 7 months ago
library(magrittr) library(lubridate)
as.POSIXct("2024-01-08 14:09:59.899") %>% round_date(., unit="0.1 sec") %>% as.character as.POSIXct("2024-01-08 14:09:59.999") %>% round_date(., unit="1 sec") %>% as.character
as.POSIXct("2024-01-08 14:09:59.999") %>% round_date(., unit="0.1 sec") %>% as.character
the result I think: 2024-01-08 14:10:00.0 the result shows: 2024-01-08 14:09:59.9
Here is an example
library(magrittr) library(lubridate)
Correctly work
as.POSIXct("2024-01-08 14:09:59.899") %>% round_date(., unit="0.1 sec") %>% as.character as.POSIXct("2024-01-08 14:09:59.999") %>% round_date(., unit="1 sec") %>% as.character
Not work as I think
as.POSIXct("2024-01-08 14:09:59.999") %>% round_date(., unit="0.1 sec") %>% as.character
the result I think: 2024-01-08 14:10:00.0 the result shows: 2024-01-08 14:09:59.9