0

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

3 Answers3

1

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"
GKi
  • 37,245
  • 2
  • 26
  • 48
1

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"

data

v1 <- c( 44245, 44242, 44245.66, 44231 )
akrun
  • 874,273
  • 37
  • 540
  • 662
0

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"
Wimpel
  • 26,031
  • 1
  • 20
  • 37