powered by
Convert numerical (especially Excel date) or character date to date. Can deal with common formats and allow different formats in one vector.
to_date( x, from_excel = TRUE, verbose = TRUE, try_formats = c("%Y-%m-%d", "%Y/%m/%d", "%Y%m%d", "%Y.%m.%d") )
A single valid value from the vector. NA if all values are invalid.
NA
A vector that stores dates in numerical or character types.
If TRUE, treat numerical values as Excel dates.
If TRUE, print the values that cannot be converted.
A character vector of date formats to try. Same as tryFormats in as.Date.
tryFormats
as.Date
to_date(c(43562, "2020-01-01", "2020/01/01", "20200101", "2020.01.01"))
Run the code above in your browser using DataLab