[tz] Issue with timezone

Paul Eggert eggert at cs.ucla.edu
Mon Jul 17 19:19:49 UTC 2023


On 2023-07-15 15:51, Ty Hanks via tz wrote:
> Having an issue with timezone ‘America/Bogota’ should be the same as ‘America/NewYork’

No, they're different timezones as Doug mentioned. Also, it's 
"America/New_York" not "America/NewYork".


> if you pull time based on it from pytz which uses your database. You get the wrong timezone a 3 or 4 hour ahead timezone.

Actually, I don't get that. It works for me on Fedora 38; see below. If 
you're having trouble, please try the recipe below to help you get 
started debugging.

Also, please read Paul Ganssle's "pytz: The Fastest Footgun in the West" 
<https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html>.

$ python3
Python 3.11.4 (main, Jun  7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red 
Hat 13.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> from datetime import datetime
 >>> from pytz import timezone
 >>> format = "%Y-%m-%d %H:%M:%S %z (%Z)"
 >>> now = datetime.now(timezone('UTC'))
 >>> print(now.strftime(format))
2023-07-17 19:12:05 +0000 (UTC)
 >>> print(now.astimezone(timezone('America/New_York')).strftime(format))
2023-07-17 15:12:05 -0400 (EDT)
 >>> print(now.astimezone(timezone('America/Bogota')).strftime(format))
2023-07-17 14:12:05 -0500 (-05)




More information about the tz mailing list