ensure_date_format | R Documentation |
Check date format. If the format is wrong ('NA') an error message is printed, else it will formatted the date in the correct way (YYYY-MM-DD)
ensure_date_format(date_input)
date_input |
Date included as input |
A character string representing the date in 'YYYY-MM-DD' format
# Example of correct date formats
ensure_date_format("2024-08-30") # "2024-08-30"
ensure_date_format("30/08/2024") # "2024-08-30"
# Example of incorrect date formats
tryCatch(
{
ensure_date_format("Aug-30")
},
error = function(e) {
message(e$message)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.