Hi R Devel,

I wrote some code which depends on 'strptime' being able to parse an
incomplete date, like this:

> base::strptime("2016","%Y")
[1] "2016-01-14 PST"

The above works - although it's odd that it gives the month and day
for Sys.time(). I might expect it to set them both to zero as the GNU
libc strptime does on my system, or to use January 1 which would also
be reasonable.

When I specify the month, however, I get NA:

> base::strptime("2016-12","%Y-%m")
[1] NA
> base::strptime("1", "%m")
[1] NA

Any reason for this to be the case?

I reported a bug here:

https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17212

but I don't think I'm getting emails from Bugzilla so maybe best to
ping me if anyone replies there instead.

I've just written a simple reimplementation of 'strptime' for my own
use; I hope this bug report may be useful to others.

Thank you,

Frederick

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to