Another format? #47

Closed
eddelbuettel opened this Issue Feb 4, 2017 · 0 comments

Projects

None yet

1 participant

@eddelbuettel
Owner

A common format is "Thu Jan 17 09:29:10 EST 2013" but the %Z conversion only works on output.
Hence:

R> library(anytime)
R> anytime("Thu Jan 17 09:29:10 EST 2013")
[1] NA
R> anytime:::testFormat("%a %b %d %H:%M:%S %z %Y", "Thu Jan 17 09:29:10 EST 2013")
[1] NA
R> anytime:::testFormat("%a %b %d %H:%M:%S %Z %Y", "Thu Jan 17 09:29:10 EST 2013")
[1] NA

One can substitute the timezone out:

R> anytime("Thu Jan 17 09:29:10  2013")
[1] "2013-01-17 09:29:10 CST"
R> 

but that is hackish.

A better trick seems to be to just block the three letters with some text, here xxx:

R> anytime:::testFormat("%a %b %d %H:%M:%S xxx %Y", "Thu Jan 17 09:29:10 EST 2013")
[1] "2013-01-17 09:29:10 CST"
R> 

That is probably more useful and worth adding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment