From ripley@stats.ox.ac.uk  Fri Jan 12 10:56:13 2001
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Fri, 12 Jan 2001 11:56:13 +0100 (MET)
Subject: [Rd] problem with strptime example (PR#811)
Message-ID: <200101121056.LAA03597@pubhealth.ku.dk>

On Fri, 12 Jan 2001, Uwe Ligges wrote:

>
> ripley@stats.ox.ac.uk wrote:
> >
> > On Thu, 11 Jan 2001 stephen@anc.ed.ac.uk wrote:
> >
> > > Hi,
> > >
> > > The help file for strptime has the following code which doesn't work
> > > for me:
> > >
> > >      ## read in date info in format `ddmmmyyyy'
> > >      x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
> > >      z <- strptime(x, "%d%b%Y")
> > > > z
> > > [1] "NA" "NA" "NA" "NA"
> > >
> > > Do these work for other people?
> >
> > Yes, on several platforms.  It will be a problem with your OS's strptime
> > code.  It must be, I think, as the alternative we supply works.
> >
> > > whereas it works fine if I use a separator (/) in the date@
> > >
> > > > strptime("9/Feb/1960", "%d/%b/%Y")
> > > [1] "1960-02-09"
> > >
> > > > strptime("9Feb1960", "%d%b%Y")
> > > [1] "NA"
> >
> > We really do not put out new features without testing them!
>
>
> Also very strange on WinNT4.0 (R-1.2.0):
>
>
>   x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
>   z <- strptime(x, "%d%b%Y")
>   z
> [1] "1960-01-01 01:00:00" "1960-01-02 01:00:00" "NA"
> "1960-07-30 01:00:00"

I don't get the NA. The 1am is a Windows bug: this only happens in
times prior to 1970, which for Windows do not exist.  It seems to assume
that if isdst is non-zero, it is DST, rather than for isdst > 0.
I have a workaround, so for 1.2.1 (on my machines) this will behave as
expected.

The date-time functions do depend on OS functions being correct, and
although I have done a lot of workarounds, no doubt more errors will
emerge.


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] problem with strptime example (PR#811)
ripley@stats.ox.ac.uk