I have a column of a data frame where some dates are formatted as
"2015-06-04"
and other dates as
"Thu Jun 04 15:12:10 2015"
Is there a way to match formatting and then add in a strptime()
?
I tried using
for (i in 1:length(d1)){
if((d1[i]) !=format("%Y-%m-%d")){
d1[i]<- as.Date(strptime(d1[i], "%a %b %d %H:%M:%S %Y"))
}
}
Where d1
is my list of dates.