0

I've udpdated this question because I've been told that the column of numbers use the Matlab origin = 1 January 2000 and the units are in seconds I'm still getting stuck though.

I have a column of date/time values expressed as numbers - these have come from Matlab. I would like to convert these to POSIXct in R.

Here is an example of what I've tried with a single value.

as.POSIXct(736908.0041, origin = "2000-01-01", tz="UTC")

But this returns "2000-01-09 12:41:48 UTC", which is not correct. The correct date should be 2017-08-02, I'm not sure about the time.

I have tried multiplying the number by both 60 and 3600 in case the units weren't really in seconds, but that hasn't helped.

heatherr
  • 143
  • 12
  • What is `736908.0041` here? – nghauran Oct 25 '18 at 16:30
  • I have a column of numbers that I'd like to convert to date/time. `736908.0041` is the first value in the column – heatherr Oct 25 '18 at 16:32
  • I mean does it represent time in seconds on another unit? – nghauran Oct 25 '18 at 16:36
  • I have that very question myself. I'm not sure how to approach this given that I lack those details. The one thing I do know is the approximate equivalent date/time. – heatherr Oct 25 '18 at 16:39
  • 1
    I've just learned that the origin is 1 January 2000 and the units are in seconds. This column of numbers was produced in Matlab. Have edited the question to reflect this – heatherr Oct 29 '18 at 18:38
  • 1
    Try out `as.POSIXct((736908.0041 - 719529)*86400, origin = "1970-01-01", tz = "UTC")` – nghauran Oct 30 '18 at 09:59

0 Answers0