5

I'm using as.POSIXct to parse times with timezones, like this:

as.POSIXct("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z")

However, if the string includes the timezone information +1300, the function returns NA:

> as.POSIXct("2009-01-05 14:19 +1300", format="%Y-%m-%d %H:%M %z")
[1] NA

Aparently +1300 is a valid timezone (NZDT – New Zealand Daylight Time). How to convince R to parse it?

rodrigorgs
  • 855
  • 2
  • 9
  • 20
  • R usually passes most of its POSIX processing to the OS libraries, I think, so you may have to do some hand-parsing here, strip the +1300, and pass `tz="NZDT"` explicitly ... – Ben Bolker Apr 20 '14 at 13:32
  • 1
    I think that might be a bug, and worth reporting. – hadley Apr 21 '14 at 15:33
  • @hadley, I've just reported it as a bug at https://bugs.r-project.org/bugzilla/show_bug.cgi?id=15768 – rodrigorgs Apr 21 '14 at 16:12
  • 2
    This [bug](http://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15768) was fixed in R 3.1.0 patched ([NEWS](http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2014/04/24#n2014-04-24)) – GSee Apr 25 '14 at 23:59

1 Answers1

1

This was a bug in 3.0.2 release, which was fixed in R-3.1.0 Patched build.

tonytonov
  • 25,060
  • 16
  • 82
  • 98