Here is a sample. Looking for result in Date and timestamp.
dput(head(df, 44245, 44242, 44245.66, 44231)
Example of result :- 2021-02-18 16:08:13
Here is a sample. Looking for result in Date and timestamp.
dput(head(df, 44245, 44242, 44245.66, 44231)
Example of result :- 2021-02-18 16:08:13
In case the numbers come from Excel you can use as.POSIXct
:
as.POSIXct(c(44245, 44242, 44245.66, 44231) * 86400, origin = "1899-12-30", tz="GMT")
#[1] "2021-02-18 00:00:00 GMT" "2021-02-15 00:00:00 GMT"
#[3] "2021-02-18 15:50:24 GMT" "2021-02-04 00:00:00 GMT"
We could also use excel_numeric_to_date
from janitor
library(janitor)
excel_numeric_to_date(v1, include_time = TRUE)
#[1] "2021-02-18 00:00:00 CST" "2021-02-15 00:00:00 CST" "2021-02-18 15:50:24 CST" "2021-02-04 00:00:00 CST"
v1 <- c( 44245, 44242, 44245.66, 44231 )
Assuming these are datatimes inported from Excel:
library( openxlsx )
strings <- c( 44245, 44242, 44245.66, 44231 )
openxlsx::convertToDateTime( strings )
# [1] "2021-02-18 00:00:00 CET" "2021-02-15 00:00:00 CET" "2021-02-18 15:50:24 CET" "2021-02-04 00:00:00 CET"