Cybernetic
Cybernetic

Reputation: 13354

Converting particular date format in R

I am trying to do a specific date conversion in R. I haven't found a solution to this particular conversion:

Sep 17, 2012

needs to be converted to:

2012-09-17

I am trying:

as.Date('Sep 17, 2012')

and:

as.Date(format('Sep 17, 2012', "%b %e, %Y")

Upvotes: 0

Views: 43

Answers (1)

tkmckenzie
tkmckenzie

Reputation: 1363

You can specify the format of the date in as.Date:

as.Date("Sep 17, 2012", "%b %e, %Y")
# [1] "2012-09-17"

Upvotes: 2

Related Questions