[Rd] [as.POSIXlt]: Incorrect conversion only for some specific date/time (PR#8654)

aziz.chaouch@gmail.com aziz.chaouch at gmail.com
Fri Mar 3 19:55:00 CET 2006


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:

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?

Thanks



More information about the R-devel mailing list