Skip to contents

Attempts to parse a date string using multiple common formats including ISO, US, and European date formats. Returns NA if no format matches.

Usage

parse_flexible_date(date_string)

Arguments

date_string

A character string representing a date.

Value

A Date object, or NA if parsing fails.

Details

Supported formats (in order of precedence):

  • ISO: YYYY-MM-DD, YYYY/MM/DD

  • US: MM-DD-YYYY, MM/DD/YYYY, MM-DD-YY, MM/DD/YY

  • Underscore: MM_DD_YYYY, MM_DD_YY

  • European: DD-MM-YYYY, DD/MM/YYYY