dateany_to_date: Reformat any date format (ISO8601 character string, POSIXt,...

View source: R/date_conversion.R

dateany_to_dateR Documentation

Reformat any date format (ISO8601 character string, POSIXt, or Date) to be a Date object

Description

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

See Also

Other Date management and conversion: generate_dtc(), is_ISO8601_calendar_datetime(), is_ISO8601_calendar_date(), is_ISO8601_ordinal_datetime(), is_ISO8601_timezone(), is_ISO8601_time(), is_ISO8601_week_datetime(), make_dy(), pattern_ISO8601_any_datetime(), pattern_ISO8601_any_date(), pattern_ISO8601_calendar_datetime(), pattern_ISO8601_calendar_date(), pattern_ISO8601_calendar_year(), pattern_ISO8601_ordinal_datetime(), pattern_ISO8601_ordinal_date(), pattern_ISO8601_timezone(), pattern_ISO8601_time(), pattern_ISO8601_week_datetime(), pattern_ISO8601_week_date(), sdtm_dtc_to_datetime(), sdtm_first_dose(), sdtm_time_actual()

Examples

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

billdenney/Rsdtm documentation built on Dec. 7, 2022, 2:11 a.m.