[Rd] as.Date function yields inconsistent results (PR#14166)

diverses at univecom.ch diverses at univecom.ch
Tue Dec 22 20:40:12 CET 2009

Full_Name: Mario Luoni
Version: 2.10.0
OS: Windows XP HE SP3
Submission from: (NULL) (

This piece of code:

zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2

yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are 

> as.Date(zzz1)
[1] "1999-03-17"
> as.Date(zzz2)
[1] "1999-03-18"

For me this looks like a bug, even though it could be a problem with timezones,
but I couldn't find documentation that would explain that behaviour.

> sessionInfo()
R version 2.10.0 (2009-10-26) 

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                         

[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grDevices datasets  splines   graphics  stats     tcltk     utils    
methods   base     

other attached packages:
[1] svSocket_0.9-48 TinnR_1.0.3     R2HTML_1.59-1   Hmisc_3.7-0    

loaded via a namespace (and not attached):
[1] cluster_1.12.1  grid_2.10.0     lattice_0.17-26 svMisc_0.9-56   tools_2.10.0

More information about the R-devel mailing list