Skip to main content

Date from text

Convert a text to a date object.

The input must match one of the following formats exactly; any other input fails the step (InvalidDateFormat):

FormatExample
%Y-%m-%d2024-04-12
%Y/%m/%d2024/04/12
%d-%m-%Y12-04-2024
%d/%m/%Y12/04/2024
%m-%d-%Y04-12-2024
%m/%d/%Y04/12/2024
warning

Formats are tried in the order above, and the day-first formats are tried before the month-first ones. An ambiguous input like 03/04/2024 therefore always parses as 3 April 2024, never 4 March 2024. Month-first parsing only applies when the value cannot be a valid day-first date (e.g. 02/13/2024).

Input

Textrequired
The text to convert to a date.

Output

Date
The date object.