Vote count:
0
Is there a better way to parse ISO8601 date representations than what I did, below?
The input datetime was formatted to an ISO8601 Standard representation (YYYY-MM-DDThh:mm-hh:mm), i.e. year-month-dayTlocaltime-UTCoffset. The UTC offset would be -ve for New York, as shown, and +ve for Warsaw, for example. I read this into R using two lines of code as follows:
First, I removed the ":" from the UTC offset (R is expecting the format nnnn for the UTC offset):
dataset$nocolon<- paste(substr(dataset$timestampISO8601,1,22),substr(dataset$timestampISO8601,24,25),sep="")
Then, I parsed the timestamps to get UTC time:
dataset$datetimeUTC <- strptime(dataset$nocolon, format="%Y-%m-%dT%H:%M:%S%z", tz="UTC")
asked 13 secs ago
Aucun commentaire:
Enregistrer un commentaire