I need to retrieve the timezone from an Arrow date object
Let's take this as an example:
import arrow
arrow_date = arrow.get("2000-01-01", tzinfo="America/Toronto")
How can I return this tzinfo exactly as it is in the code above?
I tried the following: arrow_date.format("ZZZ")
but this returns an abbreviation that won't work in my situation.
You can use the
_filename
method of the tzinfo:see also How to find the timezone name from a tzfile in python.
For a standard lib datetime object with tzinfo from
zoneinfo
, you can simply use the__str__
method: