[R] ISOdate returns incorrect date?
Patrick Connolly
p.connolly at hortresearch.co.nz
Wed Nov 19 23:21:56 CET 2003
On Wed, 19-Nov-2003 at 05:45PM +0100, Peter Dalgaard wrote:
|> Yes, something is strange for me too (RedHat 8):
|>
|> > ISOdate(1900,3,1)
|> [1] "1900-03-01 13:00:00 CET"
|> > ISOdate(1900,3,2)
|> [1] "1900-03-01 13:00:00 CET"
|>
|> Apparently, the one-day shift affects all dates after March 2, 1900,
|> and in no other year. One easily gets the suspicion that the fact that
|> 1900 was *not* a leap year has something to do with it. However,
|> strptime() which this calls indirectly is only as good as its OS-level
|> counterpart, I believe.
Using RedHat 7.3, the OS seems to know about leap years
$ cal 2 1900
February 1900
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28
Yet, as Peter says, it gets dates after ISOdate(1900,3,1) wrong for
that year (assuming there really was daylight saving then).
> ISOdate(1900,2,28)
[1] "1900-03-01 01:00:00 NZDT"
> ISOdate(1900,3,1)
[1] "1900-03-02 01:00:00 NZDT"
> ISOdate(1900,3,2)
[1] "1900-03-02 01:00:00 NZDT"
> ISOdate(1900,3,3)
[1] "1900-03-03 01:00:00 NZDT"
but all of the next year is correct.
What cal uses at shell level in the OS evidently isn't the same as
what is being used to print ISOdate output.
best
--
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
More information about the R-help
mailing list