Reputation: 171
I want to convert this date format to unix timestamp.I need this to find difference between two columns of dates.
Fri Apr 01 04:32:50 +0000 2011
What is the better way to do it in R? Should I remove first symbols that represent weekday and than use as.POSIXlt()?
Upvotes: 2
Views: 1216
Reputation: 520898
Just use strptime
and cast to numeric:
ts <- strptime("Fri Apr 01 04:32:50 +0000 2011", "%a %b %d %H:%M:%S %z %Y")
as.numeric(ts)
[1] 1301632370
Upvotes: 3