Skip to contents

All values must be converted (without additional NA values created). For character strings, the year-month-day part is required to be in ISO 8601 format, but the (ignored) time format only requires separation by a "T".

Usage

dateany_to_date(x)

Arguments

x

An ISO8601 formatted character string, POSIXt object, or Date object

Value

A Date object

Examples

dateany_to_date("2022-01-02")
#> [1] "2022-01-02"
dateany_to_date("2022-01-02T03:04") # the time part is automatically dropped
#> [1] "2022-01-02"
dateany_to_date(as.Date("2022-01-02"))
#> [1] "2022-01-02"
dateany_to_date(as.POSIXct("2022-01-02T03:04")) # the time part is still gone
#> [1] "2022-01-02"