CaptainPlanet
CaptainPlanet

Reputation: 43

Difficult Date Time Conversion in R

I'm trying to separate this date/time string in R but have not been successful. Here is an example of the strings:

"Thu Sep 28 02:11:51 +0000 2017" "Mon Oct 02 19:22:35 +0000 2017"

What is the best way to make this tidy? I've realized this is far beyond my skills.

Upvotes: 1

Views: 44

Answers (1)

Adam Warner
Adam Warner

Reputation: 1354

Try something like this:

as.POSIXct(gsub("\\+0000", '', "Thu Sep 28 02:11:51 +0000 2017"), format = "%a %b %d %H:%M:%S %Y")

which gives "2017-09-28 02:11:51 EDT"

Upvotes: 2

Related Questions