OpenQuizz
Une application de gestion des contenus pédagogiques
|
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) |
![]() | |
def | __str__ (self) |
Additional Inherited Members | |
![]() | |
zone | |
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
def __reduce__ | ( | self | ) |
def __repr__ | ( | self | ) |
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.
def fromutc | ( | self, | |
dt | |||
) |
See datetime.tzinfo.fromutc
def localize | ( | self, | |
dt, | |||
is_dst = False |
|||
) |
Convert naive time to local time
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)'
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.
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.