[Rd] (PR#8654) failure to read the help carefully!

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Mar 3 20:26:21 CET 2006


You seem unaware of Summer Time.  When a timezone moves on to Summer Time, 
there is no 2am, so you most likely specified a non-existent time.

You have not told us where you are, and we cannot tell from your junk-mail 
address (nor does the IP address resolve here, but an IP-to-geo service 
claims it is in Ottawa).  But I suspect you will find the days you mention 
are the beginning of Summer Time in your unstated timezone.

E.g. in PST8PDT

> seq(as.POSIXlt("2000/4/2 01:00"), by="hour", length=4)
[1] "2000-04-02 01:00:00 PST" "2000-04-02 03:00:00 PDT"
[3] "2000-04-02 04:00:00 PDT" "2000-04-02 05:00:00 PDT"

The help page for strptime (as used here) says

      Remember that in most timezones some times do not occur and some
      occur twice because of transitions to/from summer time.  What
      happens in those cases is OS-specific.


On Fri, 3 Mar 2006, aziz.chaouch at gmail.com wrote:

> Full_Name: Aziz Chaouch
> Version: 2.2.1
> OS: XP/2000
> Submission from: (NULL) (132.156.89.240)
>
>
> Hi,
>
> I'm not sure this is a "bug" but here is the problem:

You are specifically asked in the FAQ not to misuse R-bugs for things you 
are not *sure* are incorrect!

> I'm using the function as.POSIXlt to convert character strings into time
> objects. I'm using date format as "YYYY/M/D HH:MM" such as as.POSIXlt("1999/6/7
> 13:30"). Most of the time, this works fine. However for some reasons, some
> specific dates such as "2000/4/2 02:00" are not correctly converted with respect
> to hours (the converted hour is 01:00 while the input was 02:00). Look for the
> result in R:
>
>> as.POSIXlt("2000/4/2 02:00")
> [1] "2000-04-02 01:00:00"
>
> Strangely, other hours are converted correctly:
>
>> as.POSIXlt("2000/4/2 01:00")
> [1] "2000-04-02 01:00:00"
>> as.POSIXlt("2000/4/2 03:00")
> [1] "2000-04-02 03:00:00"
>
> I've only experienced this problem for some specific dates when the time is set
> to 02:00.
>
> The following list shows date/time that have problems so far but obviously there
> are more:
> "2000/4/2 02:00"
> "2001/4/1 02:00"
> "2002/4/7 02:00"
> "2003/4/6 02:00"
> "2004/4/4 02:00"
> "2005/4/3 02:00"
>
> Does anybody knows what's the problem? Am I missing something?

Yes, yes.

-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list