aziz.chaouch@gmail.com
2006-Mar-03 18:55 UTC
[Rd] [as.POSIXlt]: Incorrect conversion only for some specific date/time (PR#8654)
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
Gabor Grothendieck
2006-Mar-03 19:03 UTC
[Rd] [as.POSIXlt]: Incorrect conversion only for some specific date/time (PR#8654)
Its due to daylight savings time in your time zone. If you don't want that then use the tz = "GMT" argument to specify GMT time zone as GMT has no daylight savings time or set your entire session that way, i.e. Sys.putenv(TZ = "GMT"). Also read the Help Desk article in R News 4/1 on dates and times. On 3/3/06, aziz.chaouch at gmail.com <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: > > 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 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Seemingly Similar Threads
- (PR#8654) failure to read the help carefully!
- Maximum likelihood estimate of bivariate vonmises-weibulldistribution
- Date conversion with as.POSIXct and as.POSIXlt (PR#9196)
- Maximum likelihood estimate of bivariate vonmises-weibull distribution
- Date arithmetic coerces POSIXlt to POSIXct?