[MDEV-30827] Function to print a time zone abbreviation for a given time zone at a given date Created: 2023-03-10 Updated: 2023-09-06 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Time zones |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Remy Fox | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
I want to get the time zone from a date+time plus location. Some cities in the world exist in different time zones, depending on the time of the year. Something like `TIME_ZONE_ABBREVIATION(dateTimeExpression, timeZoneLocation)`.
Time zone information is not stored along date time values, which make this a hard or impossible task to work around. |
| Comments |
| Comment by Sergei Golubchik [ 2023-03-30 ] | |||||||||||||||||||||||
|
"Europe/Amsterdam" is not a location, it's a proper time zone name:
And it's better than the abbreviation, because
| |||||||||||||||||||||||
| Comment by Remy Fox [ 2023-03-31 ] | |||||||||||||||||||||||
|
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:
To clarify, this is how I used the terms:
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. | |||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-05-22 ] | |||||||||||||||||||||||
|
Ok, as this isn't a bug report, I'm going to close this. But here's a how you can achieve that.
This is not a complete solution because
| |||||||||||||||||||||||
| Comment by Remy Fox [ 2023-09-06 ] | |||||||||||||||||||||||
|
It's not an acute bug report, but still it's a hole in mariadb formatting capabilities. This formatting option is available in many programming languages. For example, in PHP we can write `$date->format("T")`. Why close it like that? it's not like jira is only for acute bugs of existing functionality... | |||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-09-06 ] | |||||||||||||||||||||||
|
It turns out we're kind of doing it after all. Not quite what you need, but Within 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. |