Welcome to the community!
Try like this:
sample_date_in_character <- "20190717-18:00:00"
converted_to_datetime <- as.POSIXct(x = sample_date_in_character,
format = "%Y%m%d-%H:%M:%S")
converted_to_datetime
#> [1] "2019-07-17 18:00:00 IST"
Created on 2019-09-28 by the reprex package (v0.3.0)
Look at the documentation of strptime for more details on the formats. There's also a separate package lubridate to handle to dates and times.
Hope this helps.