I want to convert an Excel format date into yyyy-mm-dd in order to convert a data.frame in a zoo object.
Using the two following formulas does not give the same result?
Why does that happen?
> as.Date(41375, origin = "1899-12-30")
[1] "2013-04-11"
> as.Date(41375, tz = "CET")
[1] "2083-04-13"
"Date"
class has no time zones so tz=
is meaningless. I assume you have the zoo package loaded in which case origin = "1970-01-01"
is supplied as the default so the second line of code in the question is the same as:
as.Date(41375, origin = "1970-01-01")
There is a discussion of Excel dates and R in the Help Desk article of R News 4/1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With