Hi @Alec_Watson,
Welcome to the RStudio Community Forum.
Your code was very close to working - the format of the "start_date" input string was wrongly specified:
library(tidyverse)
tripdata_2020to2021 <- data.frame(started_at = c("2020-05-23 21:16:11",
"2020-05-24 22:16:11",
"2020-05-25 23:16:11"))
tripdata_2020to2021 %>%
separate(
started_at,
into = c("start_date", "start_time"),
sep = " ",
remove = FALSE
) %>%
mutate(
start_date = lubridate::as_date(start_date, format = "%Y-%m-%d"),
start_time = hms::as_hms(str_c(start_time, "00"))
)
#> started_at start_date start_time
#> 1 2020-05-23 21:16:11 2020-05-23 21:16:00
#> 2 2020-05-24 22:16:11 2020-05-24 22:16:00
#> 3 2020-05-25 23:16:11 2020-05-25 23:16:00
Created on 2021-05-24 by the reprex package (v2.0.0)