I have a dataset with dates formatted like this:
> head(dfed$`POSTED DATE`)
[1] NA
[2] "Fri, 26 Jul 2024 00:00:00 (Brussels local time)"
[3] "Thu, 4 Jul 2024 00:00:00 (Brussels local time)"
[4] "Tue, 5 Nov 2024 17:00:00 (Brussels local time)"
[5] "Thu, 18 Apr 2024 00:00:00 (Brussels local time)"
[6] "Wed, 7 Dec 2022 00:00:00 (Brussels local time)"
I want R to read them as dates so that:
Input: “Fri, 26 Jul 2024 00:00:00 (Brussels local time)”
Output: 26/07/2024
What I tried:
- lubridate::as_datetime gave me ‘All formats failed to parse. No formats found’:
> as_datetime("23 Feb 2022 00:00:00")
[1] NA
Warning message:
All formats failed to parse. No formats found.
- Searching through old questions didn’t help