I have this date format: 2016-04-14 and I want to change it to 14/4/16 This seems like a simple task but for some reason my strategy is not working. Here is my code: '''' df$Date <- as.Date(df$Date,format = "%d/%m/%y") ''''
Asked
Active
Viewed 60 times
0
-
2Does this answer your question? [Changing date format in R](https://stackoverflow.com/questions/7439977/changing-date-format-in-r) – mcskinner Apr 16 '20 at 03:42
-
`lubridate` package can be handy dealing with dates – QAsena Apr 16 '20 at 03:44
-
1You may need to change to character first, and then to date: `as.Date(as.character(df$Date), format = "%d/%m/%y")` – Marc in the box Apr 16 '20 at 03:48
1 Answers
1
If you want date in specific format use format
:
format(as.Date(df$Date), "%d/%m/%y")

Ronak Shah
- 377,200
- 20
- 156
- 213