v.22.9Improvement
Allow String to Date and Date32 Conversion for DateTime Formats
Allow conversion fromStringwithDateTime64like2022-08-22 01:02:03.456toDateandDate32. Allow conversion from String with DateTime like2022-08-22 01:02:03toDate32. This closes #39598. #40475 (Alexey Milovidov).
Why it matters
This feature addresses the need to directly convert string representations of date and time with fractional seconds (DateTime64) or standard DateTime format to theDate and Date32 data types in ClickHouse. It simplifies data ingestion and processing by allowing users to handle such conversions without additional parsing or transformation steps.How to use it
Users can simply cast or convertString values like '2022-08-22 01:02:03.456' or '2022-08-22 01:02:03' to Date or Date32. For example:SELECT CAST('2022-08-22 01:02:03.456' AS Date)or
SELECT CAST('2022-08-22 01:02:03' AS Date32)