> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Luis Felipe Parra
> Sent: Tuesday, March 01, 2011 3:07 PM
> To: r-help
> Subject: [R] Difference in numeric Dates between Excel and R
> 
> Hello. I am using some dates I read in excel in R. I know the excel
> origin
> is supposed to be 1900-1-1. But when I used as.Date with origin=1900-1-
> 1 the
> dates that R reported me where two days ahead than the ones I read from
> Excel. I noticed that when I did in R the following:
> 
> > as.Date("2011-3-4")-as.Date("1900-1-1")
> Time difference of 40604 days
> 
> but if I do the same operation in Excel the answer is 40605. Does
> anybody
> know what can be going on?
> 

I think so.  It is a known problem that Excel thinks 1900 was a leap year, but 
it was not.  So Excel counts an extra day (for nonexistent Feb 29, 1900).  In 
addition,  Excel considers "1900-01-01" as day 1, not day 0.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to