strptime() mysteriously adds a day to a date, unless the year
is specified. Tested on:
Linux (RedHat 6.0) - R version 1.4.1 and R-devel.
Windows - R version 1.4.1
Bug isn't found on OpenBSD, R version 1.4.1.
Transcript:
R : Copyright 2002, The R Development Core Team
Version 1.4.1 (2002-01-30)
...
## BUG:
## strptime seems to add a day to the request, unless the year
## is added as part of the format.
strptime("11 Apr 22:00",format="%d %b %H:%M")
[1] "2002-04-12 22:00:00 NZST"
## note - we gained a day.
## goes away if we include the year
strptime("11 Apr 22:00 2002",format="%d %b %H:%M %Y")
[1] "2002-04-11 22:00:00 NZST"
## R 1.4.1, running on Linux RH 6.0.
version
_
platform i586-pc-linux-gnu
arch i586
os linux-gnu
system i586, linux-gnu
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
## Bug also appears in R-devel (downloaded 16 April 2002).
## For R-devel:
version
platform i586-pc-linux-gnu
arch i586
os linux-gnu
system i586, linux-gnu
status Under development (unstable)
major 1
minor 5.0
year 2002
month 04
day 16
language R
## Have also reproduced identical results in the Windows verion
version
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
##
## Unable to reproduce bug under OpenBSD 3.0
version
_
platform i386-unknown-openbsd3.0
arch i386
os openbsd3.0
system i386, openbsd3.0
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
## <speculation>
## This looks very OS specific.
## </speculation>
Indigo Industrial Controls Ltd.
64-21-343-545
jasont@indigoindustrial.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._