v.21.3New Feature

Added timezoneOffset function to return UTC offset in seconds

Added timezoneOffset(datetime) function which will give the offset from UTC in seconds. This close #issue:19850. #19962 (keenwolf).
Added the timezoneOffset(datetime) function that returns the offset from UTC in seconds for a given datetime value.

Why it matters

This feature provides users with a simple way to obtain the time zone offset from UTC as a numeric value in seconds, which helps when working with time zone conversions, calculations, or displays that require an explicit offset representation.

How to use it

Use the function by passing a datetime value to timezoneOffset(datetime). It will return the offset from UTC in seconds. For example:

SELECT timezoneOffset(toDateTime('2024-01-01 12:00:00')) AS offset_seconds;