v.23.10Improvement

Functions addDate and subDate Support String-Encoded Date Arguments for Enhanced MySQL Compatibility

Functions (add|sub)Date now support string-encoded date arguments, e.g. SELECT addDate('2023-10-22 11:12:13', INTERVAL 5 MINUTE). The same support for string-encoded date arguments is added to the plus and minus operators, e.g. SELECT '2023-10-23' + INTERVAL 1 DAY. This increases compatibility with MySQL and is needed by Tableau Online. #55960 (Robert Schulze).
The addDate and subDate functions now support string-encoded date arguments. Additionally, the plus and minus operators have been enhanced to accept string-encoded date inputs.

Why it matters

This feature improves compatibility with MySQL by allowing date and datetime values to be passed as strings directly to date arithmetic functions and operators. It also facilitates integration with tools like Tableau Online, which rely on this functionality.

How to use it

Users can now pass date or datetime arguments as strings in functions such as addDate and subDate, for example: SELECT addDate('2023-10-22 11:12:13', INTERVAL 5 MINUTE). Similarly, they can use string-encoded dates with plus and minus operators: SELECT '2023-10-23' + INTERVAL 1 DAY.