-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to get Olson/POSIX name of a timezone #76
Comments
This seems reasonable. Feel free to make a pull request. One thing I'd be a bit worried about is cross-platform compatibility here. You can probably pull it from the filename, but on *nix systems, I'm getting: >>> from dateutil import tz
>>> tzla = tz.gettz('America/Los_Angeles')
>>> print(tzla._filename)
'/usr/share/zoneinfo/America/Los_Angeles'
>>> tzmet = tz.gettz('MET')
>>> print(tzmet._filename)
'/usr/share/zoneinfo/MET' Whereas on Windows I'm getting: >>> from dateutil import tz
>>> tzla = tz.gettz('America/Los_Angeles')
>>> print(tzla._filename)
'America/Los_Angeles'
>>> tzmet = tz.gettz('MET')
>>> print(tzmet._filename)
'MET' I'm guessing this is because on the *nix systems it's using the system zoneinfo file, and on Windows it's using the one provided by dateutil. If you decide not to make a PR, I can dig into this later. |
Hey @pganssle I had a go at implementing this. (dateutil) chris@ThinkPad:~/dateutil$ python
Python 3.8.3 (default, Jul 7 2020, 18:57:36)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dateutil import tz
>>> nyc=tz.gettz("America/New_York")
>>> nyc
tzfile('/usr/share/zoneinfo/America/New_York')
>>> nyc.zone_name
'America/New_York' It's currently exposed on |
@systemcatch I would be interested in this functionality. Do you still have your implementation lying around? (and want to make a PR?) |
Hey @jorisvandenbossche I will take a look but I have a feeling that local branch may be gone. |
At this point it's probably easiest to wait for #1130 to be done, and/or use |
@pganssle thanks for that pointer, looking forward to that change then. About using |
I want to save a timezone name in the database, so maybe it would be nice to have an ability to get Olson or POSIX name of the timezone.
Example:
Please let me know what you think? I can try to implement this.
The text was updated successfully, but these errors were encountered: