v.23.10Improvement

Functions toDayOfWeek, toYearWeek, and toWeek Updated to Support String Arguments

Functions toDayOfWeek (MySQL alias: DAYOFWEEK), toYearWeek (YEARWEEK) and toWeek (WEEK) now supports String arguments. This makes its behavior consistent with MySQL's behavior. #55589 (Robert Schulze).
The functions toDayOfWeek (DAYOFWEEK alias), toYearWeek (YEARWEEK alias), and toWeek (WEEK alias) now support String arguments, making their behavior consistent with MySQL.

Why it matters

This feature addresses inconsistency between ClickHouse and MySQL by allowing these date functions to accept String input. This enables easier migration and compatibility for users switching from MySQL or working with string-formatted date values.

How to use it

Use the functions toDayOfWeek, toYearWeek, or toWeek and pass string-formatted date arguments directly, for example:

SELECT toDayOfWeek('2024-06-20'), toYearWeek('2024-06-20'), toWeek('2024-06-20')