v.21.2New Features

Added parseDateTimeBestEffortUSOrZero and parseDateTimeBestEffortUSOrNull Functions

Added functions parseDateTimeBestEffortUSOrZero, parseDateTimeBestEffortUSOrNull. #19712 (Maksim Kita).
Added new DateTime parsing functions parseDateTimeBestEffortUSOrZero and parseDateTimeBestEffortUSOrNull to ClickHouse.

Why it matters

These functions provide enhanced DateTime parsing by attempting to parse datetime strings in a US format and returning either zero or NULL when parsing fails. This improves robustness when dealing with varied or imperfect datetime input data, preventing errors and enabling smoother data ingestion.

How to use it

Use the functions in SQL queries to parse datetime strings with US format tolerance. For example:

SELECT parseDateTimeBestEffortUSOrZero('12/31/2023 23:59:59');
SELECT parseDateTimeBestEffortUSOrNull('invalid datetime');

The first returns a DateTime value or zero if parsing fails, the second returns NULL on failure.