I have a date/time column saved like this 20200821144500. How do I convert it to date and time format? I tried as.POSIXct('20200821144500',format="%Y-%m-%d %H:%M:%S") which returned NA. Am I using the wrong format or is there another way to do it?
The main feature here is to tell which is first year month or day etc.. in the string. and to use HMS , because:
library(lubridate)
string <- "20200821144500"
parse_date_time(string, "ymd_HMS")
[1] "2020-08-21 14:45:00 UTC"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With