datetime - Parsing ISO8601 date and time format in R -


this question has answer here:

this should quick - parsing following format in r:

2013-04-05t07:49:54-07:00

my current approach

require(stringr)  timenot <- str_replace_all("2013-04-05t07:49:54-07:00", "t", " ")  timep <- strptime(timenot, "%y-%m-%d %h:%m:%s%z", tz="utc") 

but gives na.

%z signed offset in hours, in format hhmm, not hh:mm. here's 1 way remove last :.

newstring <- gsub("(.*).(..)$","\\1\\2","2013-04-05t07:49:54-07:00") (timep <- strptime(newstring, "%y-%m-%dt%h:%m:%s%z", tz="utc")) # [1] "2013-04-05 14:49:54 utc" 

also note don't have remove "t".


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -