Question

I wrongly stored the result of Sys.time() as type character. E.g., "2014-05-05 10:52:11 CEST" is converted to "1399279910.87737". How can I get the time back?

Was it helpful?

Solution

This should work:

as.POSIXct(as.numeric("1399279910.87737"), origin="1970-01-01")

The difference ought to be because of the rounding in the string representation. You could try playing with origin to make it match if the difference of a few seconds is a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top