I acknowledge that there are multiple similar questions, but I did not find so far an answer, which works for me, maybe because of AM/PM. I would like not to remove the latter.
I have a column Trip Start Timestamp
, which looks like
12/01/2019 12:30:00 AM
12/01/2019 12:31:00 AM
12/01/2019 12:32:00 AM
I am trying to remove AM/PM and split into two variables Start date
and Start time
.
Ideal output:
Start date Start time
12/01/2019 12:30:00 AM
I would like to read it as time series.
My best guess so far
Date <- format(as.POSIXct(strptime(taxi_2020$`Trip Start Timestamp`, "%d/%m/%Y %H:%M:S")), format = "%m/%d/%Y")
Time <- format(as.POSIXct(strptime(taxi_2020$`Trip Start Timestamp`, "%d/%m/%Y %H:%M:S")), format = "%H:%M:S")
head(Date)
head(Time)
Gives me
[1] NA NA NA NA NA NA
[1] NA NA NA NA NA NA
Update
It looks like columns with time and date has some problems with format.
dput
can be found here
So far the solution by @Ronak Shah works. Technically I finally separated the data, but probably identified another problem with UTF-8