Let's not worry too much about semantics. The word time zone is used for different, conflicting concepts. We aren't the first people to get confused by it:
- Europe/Amsterdam, America/Havana, Asia/Jakarta these are locations, some of which have clocks whose offset differs during the year and even some only had that historically.
- UTC+1, UTC-4, UTC-5 these express offsets relative to UTC.
- +01:00, -04:00, -05:00 these are another way to express offsets relative to UTC.
- Central European Time, Central European Summe Time, West African Time are different names for offsets at certain locations in the world. For example, Central European Time has offset +01:00, but so does West African Time.
- CET, CEST, CDT these are abbreviations of the previous category.
To clarify, this is how I used the terms:
- Time zone location: values like Europe/Amsterdam whose offset relative to UTC may change depending on the datetime value.
- Offset: a certain amount of time relative to UTC.
- Time zone: values like Central European Time, which are technically aliases for offsets.
- Time zone abbreviation: values like CET
Normally when a programmer formats a date time value adjusted by the time zone, they will use some kind of time zone location like Europe/Amsterdam. What I am asking for is a function to express a value that includes the time zone abbreviation so that it becomes possible to format a datetime as e.g. '30/03/2023 10:21 CEST'.
It is not a matter of whether Europe/Amsterdam is better than CET/CEST, because they are two different things. I just want to express a datetime's offset to users without writing down a number. This is a common operation in all programming languages that I know.
It turns out we're kind of doing it after all. Not quite what you need, but
MDEV-31684will add support for %z and %Z in DATE_FORMAT, so it'll be able to print time zone abbreviations.Within
MDEV-31684it'll only work for the current time zone (@@time_zone) so not quite what you asked for.But perhaps we can build on that to make it work for an arbitrary time zone, like DATE_FORMAT(date, format, timezone)?
Anyway, I'll reopen the task.