# numeric
utils_as_time(
x = c(-123120, 1200)
)
# character string to Date
utils_as_time(
x = c("2022-03-17", "2024-02-05")
)
# incomplete character strings to Date
utils_as_time(
x = c("2022", "2024")
)
utils_as_time(
x = c("2022-02", "2024-03")
)
# character string to POSIXct
utils_as_time(
x = c("2022-03-17 12:30:45", "2024-02-05 11:15:45")
)
# Date vector (returns the input)
utils_as_time(
x = as.Date(c("2022-03-17", "2024-02-05"))
)
# POSIXct vector (returns the input)
utils_as_time(
x = as.POSIXct(c("2022-03-17 12:30:45", "2024-02-05 11:15:45"))
)
Run the code above in your browser using DataLab