v.23.1New Feature

Added age function for date difference calculation

Added age function to calculate the difference between two dates or dates with time values expressed as the number of full units. Closes #41115. #44421 (Robert Schulze).
Added the age function to calculate the difference between two date or datetime values as the number of full units.

Why it matters

The new age function provides a precise way to compute the interval between two dates or timestamps, returning the difference in full units (e.g., years, months, days). This helps users perform accurate date and time interval calculations more conveniently and consistently within ClickHouse.

How to use it

Use the age function by passing two date or datetime expressions to it, for example: SELECT age(date1, date2). It returns the difference as a full unit count based on the types of inputs.