Fix your format specification? ?strptime
On June 10, 2020 1:20:01 AM PDT, Luigi Marongiu <marongiu.lu...@gmail.com> wrote: >Hello, >I have been trying to convert European short dates formatted as >dd/mm/yy into the ISO 8601 but the function as.Dates interprets them >as American ones (mm/dd/yy), thus I get: > >``` >oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20", >"27/01/20", "28/01/20", "29/01/20", "30/01/20", > "31/01/20", "01/02/20", "02/02/20", "03/02/20", >"04/02/20", "05/02/20", "06/02/20", "07/02/20") >isoDates = as.Date(oriDates, format = "%m/%d/%y") >> isoDates > [1] NA NA NA NA NA >NA NA > [8] NA NA "2020-01-02" "2020-02-02" "2020-03-02" >"2020-04-02" "2020-05-02" >[15] "2020-06-02" "2020-07-02" >``` > >How can I convert properly? -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.