[R] Difference in numeric Dates between Excel and R

Erich Neuwirth erich.neuwirth at univie.ac.at
Wed Mar 2 12:11:50 CET 2011


A detailed description of the Excel problem as seen through the eyes of
MS can be found at

http://support.microsoft.com/kb/214326

On 3/2/2011 8:15 AM, Prof Brian Ripley wrote:
> 
>      ## Excel is said to use 1900-01-01 as day 1 (Windows default) or
>      ## 1904-01-01 as day 0 (Mac default), but this is complicated by Excel
>      ## thinking 1900 was a leap year.
>      ## So for recent dates from Windows Excel
>      as.Date(35981, origin="1899-12-30") # 1998-07-05
>      ## and Mac Excel
>      as.Date(34519, origin="1904-01-01") # 1998-07-05
> 
> So the origin you used is off by 2 days: one for the origin being day 1
> and one for Windows Excel's ignorance of the calendar.
> 
> Note too that these are *default*: they can be changed in Excel.
> 
>> Thank you
>> Felipe Parra
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
> 
> PLEASE do try to do your own homework (and not send HTML), as we
> requested there.  It is galling that you ask here about bugs in Excel,
> bugs that are even documented in R's help.  In future, please use the
> Microsoft help you paid for with Excel if it disagrees with R.
>



More information about the R-help mailing list