Convert from excel time number to R POSIXct type.
convertToDateTime(x, origin = "1900-01-01", ...)
x | A numeric vector |
---|---|
origin | date. Default value is for Windows Excel 2010 |
... | Additional parameters passed to as.POSIXct |
Excel stores dates as number of days from some origin date
## 2014-07-01, 2014-06-30, 2014-06-29 x <- c(41821.8127314815, 41820.8127314815, NA, 41819, NaN) convertToDateTime(x)#> [1] "2014-07-01 19:30:20 UTC" "2014-06-30 19:30:20 UTC" #> [3] NA "2014-06-29 00:00:00 UTC" #> [5] NAconvertToDateTime(x, tz = "Australia/Perth")#> [1] "2014-07-01 11:30:20 UTC" "2014-06-30 11:30:20 UTC" #> [3] NA "2014-06-28 16:00:00 UTC" #> [5] NAconvertToDateTime(x, tz = "UTC")#> [1] "2014-07-01 19:30:20 UTC" "2014-06-30 19:30:20 UTC" #> [3] NA "2014-06-29 00:00:00 UTC" #> [5] NA