tz_util – Utilities for dealing with timezones in Python

Timezone related utilities for BSON.

class bson.tz_util.FixedOffset(offset: Union[float, datetime.timedelta], name: str)

Fixed offset timezone, in minutes east from UTC.

Implementation based from the Python standard library documentation. Defining __getinitargs__ enables pickling / copying.

dst(dt: Optional[datetime.datetime]) datetime.timedelta

datetime -> DST offset as timedelta positive east of UTC.

tzname(dt: Optional[datetime.datetime]) str

datetime -> string name of time zone.

utcoffset(dt: Optional[datetime.datetime]) datetime.timedelta

datetime -> timedelta showing offset from UTC, negative values indicating West of UTC

bson.tz_util.utc: bson.tz_util.FixedOffset = <bson.tz_util.FixedOffset object>

Fixed offset timezone representing UTC.