df <- data.frame(
id = 1:3,
event.time = c("2020-01-01 08:30:00",
"2020-01-02 09:15:00",
"2020-01-03 10:00:00"),
label = c("a", "b", "c"),
stringsAsFactors = FALSE)
## Identify the date-time column(s) and the format to use.
DetectPosixct(df)
## Convert them in place.
converted <- ConvertPosixct(df)
sapply(converted, class)
## Inspect (or override) the default candidate formats.
DefaultPosixctFormats()
Run the code above in your browser using DataLab