Supported in: Batch, Streaming
Returns the date given a formatted string in accordance to the Java DateTimeFormatter. The default formats are yyyy-MM-dd
and yyyy-MM-dd'T'HH:mm:ss.SSSXXX
. The formats are run in order, the first matching format will be returned.
Expression categories: Cast, Datetime
Output type: Date
Description: Date formats are optional Argument values:
Output: 2020-04-28
Description: Date formats are optional Argument values:
Output: 2020-04-28
Description: Dates parsed with a single format. Argument values:
Output: 2020-04-28
Description: Multiple formats used to parse dates Argument values:
Output: 2020-04-28
Description: If dates are missing leading zeros, they are still parsed correctly using this "yyyy-M-d" format. Argument values:
date
date | Output |
---|---|
2020-04-08 | 2020-04-08 |
2020-4-8 | 2020-04-08 |
2020-10-10 | 2020-10-10 |
Description: Strings can contain a timestamp Argument values:
Output: 2020-04-28
Description: Timezone can change the date. Argument values:
Output: 2020-04-27
Description: Null columns remain null Argument values:
Output: null
Description: Invalid data is parsed to null Argument values:
Output: null
Description: Incorrect formats parse everything to null Argument values:
Output: null
Description: Dates based only on week of year are not supported. Argument values:
Output: null