I have two columns in the df named alldf one is started_at and the other ended_at.
"2020-04-19 07:59:05"
The class is in the character format, and I need to subtract ended_at - started_at
.
I tried the following.
as.Date(alldf$started_at,'%Y-%m-%d')
as.Date(alldf$started_at,'%Y-%m-%d %H:%M:%S')
alldf$ended_year <- as.integer(alldf$ended_year)
All of them comes with NA for %H:%M:%S
Any help is very welcome.