I am trying to extract the date as yyyy-mm-dd (2008-12-30) using R. So, only the year, month and day.
My original date in my data looks like this "2008-12-30 00:00:00.0000000"
.
I have tried below:
dfs$date<-as.POSIXct(dfs$date, format="%Y-%m-%d")
dfs$date <-as.Date(dfs$date, format="%Y-%m-%d")
both two returned null for 10% of the original dates in my data, but the rest 90% seemed to be right.
I would really appreciate any suggestion to fix this!