Günal
Günal

Reputation: 99

How to convert date format stored in a variable in R?

I need to convert the date format. Here is mine:

> date
      date
1   16.08.2013
2   17.08.2013
3   18.08.2013

The format I desire is

> date
       date
1   2013-08-16
2   2013-08-17
3   2013-08-18

I triedas.Date, but could not make it work. Any suggestions?

Upvotes: 0

Views: 35

Answers (1)

road_to_quantdom
road_to_quantdom

Reputation: 1361

try this:

date$date <- as.Date(as.character(date$date),format="%d.%m.%Y")

Upvotes: 2

Related Questions