v.23.9New Feature
SQL Functions Support Non-Constant Timezone Arguments
SQL functionstoString(datetime, timezone)andformatDateTime(datetime, format, timezone)now support non-constant timezone arguments. #53680 (Yarik Briukhovetskyi).
Why it matters
Previously, these functions only accepted constant timezone strings, limiting their flexibility when working with data containing multiple timezones. This feature allows dynamic timezone inputs, enabling more versatile and accurate datetime formatting based on varying timezone values in the dataset.How to use it
Pass a column or expression representing the timezone as the timezone argument totoString or formatDateTime. For example:SELECT toString(event_time, user_timezone) FROM events;This enables formatting datetime values according to different timezones on a per-row basis.