v.24.7New Feature

Add SQL Functions for Date and Time Manipulation

Add SQL functions changeYear, changeMonth, changeDay, changeHour, changeMinute, changeSecond. For example, SELECT changeMonth(toDate('2024-06-14'), 7) returns date 2024-07-14. #63186 (cucumber95).
Introduces new SQL functions changeYear, changeMonth, changeDay, changeHour, changeMinute, and changeSecond for modifying specific parts of date and datetime values.

Why it matters

These functions simplify changing individual components of date or datetime fields without complex date arithmetic or multiple function calls. This makes date/time manipulation more straightforward and readable in SQL queries.

How to use it

Use the functions by passing a date or datetime value and the new value for the respective component. For example:

SELECT changeMonth(toDate('2024-06-14'), 7)

returns the date 2024-07-14.