ISO-8601 with time zone designator, format handling with fCalendar/chron
Try this: library(chron) x <- "2005-12-05T00:00:00+02:00" datetime <- chron(as.Date(x), substring(x, 12, 19)) sgn <- switch(substring(x, 20, 20), "+" = +1, "-" = -1) offset <- as.numeric(times(paste(substring(x, 21), "00", sep = ":"))) datetime + sgn * offset # or perhaps the last line should be: datetime - sgn * offset
On 5/31/07, jeam <eraslan.cem at gmail.com> wrote:
Dear All; I have searched the forum but couldn't find a similar problem. Currently I am working with a very large set of XML files and the date is formatted something like that (YYYY-MM-DDThh:mm:ss+TZD) Ex: "2005-12-05T00:00:00+02:00" Previously, I've tried chron and fCalendar but couldn't find a way to import this data as a time object. I think somehow, timeDate may handle it, i tried almost all variations formats, but couldn't make it work. Any help appreciated... Regards -- View this message in context: http://www.nabble.com/ISO-8601-with-time-zone-designator%2C-format-handling-with-fCalendar-chron-tf3849304.html#a10903450 Sent from the Rmetrics mailing list archive at Nabble.com.
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.