[R] ISOdate returns incorrect date?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Nov 20 01:45:52 CET 2003


Patrick Connolly <p.connolly at hortresearch.co.nz> writes:

> On Wed, 19-Nov-2003 at 05:03PM +0000, Prof Brian Ripley wrote:
> 
> |> For the record, ISOdate *is* giving the right answer, a POSIXct object.
> |> 
> |> The problem is in printing, where there was a simple coding bug: is_year 
> |> was applied to the POSIX `year' which is year-1900.
> 
> I can't see why it doesn't effect dates before 2nd March.

Well, it's an open source program....

2nd March is day 60 and the code works out month and day by
subtracting monts as long as the result is positive. If the code
thinks that there are 29 days in February, then 2nd March becomes the
1st, etc.

The thing that puzzles me is that the old code didn't also claim that
there was a Feb 29 in 1900, and that there wasn't a corresponding issue
with the year 2000 being a leap year by the %%400 rule. But there
wasn't and there still isn't...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list