OpenQuizz
Une application de gestion des contenus pédagogiques
StaticTzInfo Class Reference
Inheritance diagram for StaticTzInfo:
Collaboration diagram for StaticTzInfo:

Public Member Functions

def fromutc (self, dt)
 
def utcoffset (self, dt, is_dst=None)
 
def dst (self, dt, is_dst=None)
 
def tzname (self, dt, is_dst=None)
 
def localize (self, dt, is_dst=False)
 
def normalize (self, dt, is_dst=False)
 
def __repr__ (self)
 
def __reduce__ (self)
 
- Public Member Functions inherited from BaseTzInfo
def __str__ (self)
 

Additional Inherited Members

- Static Public Attributes inherited from BaseTzInfo
 zone
 

Detailed Description

A timezone that has a constant offset from UTC

These timezones are rare, as most locations have changed their
offset at some point in their history

Member Function Documentation

◆ __reduce__()

def __reduce__ (   self)

◆ __repr__()

def __repr__ (   self)

◆ dst()

def dst (   self,
  dt,
  is_dst = None 
)
See datetime.tzinfo.dst

is_dst is ignored for StaticTzInfo, and exists only to
retain compatibility with DstTzInfo.

◆ fromutc()

def fromutc (   self,
  dt 
)
See datetime.tzinfo.fromutc

◆ localize()

def localize (   self,
  dt,
  is_dst = False 
)
Convert naive time to local time

◆ normalize()

def normalize (   self,
  dt,
  is_dst = False 
)
Correct the timezone information on the given datetime.

This is normally a no-op, as StaticTzInfo timezones never have
ambiguous cases to correct:

>>> from pytz import timezone
>>> gmt = timezone('GMT')
>>> isinstance(gmt, StaticTzInfo)
True
>>> dt = datetime(2011, 5, 8, 1, 2, 3, tzinfo=gmt)
>>> gmt.normalize(dt) is dt
True

The supported method of converting between timezones is to use
datetime.astimezone(). Currently normalize() also works:

>>> la = timezone('America/Los_Angeles')
>>> dt = la.localize(datetime(2011, 5, 7, 1, 2, 3))
>>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
>>> gmt.normalize(dt).strftime(fmt)
'2011-05-07 08:02:03 GMT (+0000)'

◆ tzname()

def tzname (   self,
  dt,
  is_dst = None 
)
See datetime.tzinfo.tzname

is_dst is ignored for StaticTzInfo, and exists only to
retain compatibility with DstTzInfo.

◆ utcoffset()

def utcoffset (   self,
  dt,
  is_dst = None 
)
See datetime.tzinfo.utcoffset

is_dst is ignored for StaticTzInfo, and exists only to
retain compatibility with DstTzInfo.

The documentation for this class was generated from the following file: