Working with Twitter Timestamps in R
R
Twitter
Reading Twitter time and date strings in R
Tweets returned by Twitter’s API contain a timestamp field called “created_at” that cannot be directly read by R. For example, using the default behavior of as.POSIXct(timestamp) produces incorrect internal date representations. Thankfully, formatting the timestamp is simple:
## Assuming your timestamps are located in the variable "timestamps":
date_format <- "%a %b %d %H:%M:%S %z %Y"
timestamps <- as.POSIXct(strptime(timestamps, date_format, tz = "EST"), tz = "EST")