Package upoints :: Module osm :: Class TzOffset
[hide private]
[frames] | no frames]

Class TzOffset

     object --+    
              |    
datetime.tzinfo --+
                  |
                 TzOffset

Time offset from UTC
Instance Methods [hide private]
 
__init__(self, tzstring)
Initialise a new TzOffset object
str
__repr__(self)
Self-documenting string representation
 
dst(self, dt=None)
Daylight Savings Time offset
str
as_timezone(self)
Create a human-readable timezone string
 
utcoffset(self, dt=None)
Return the offset in minutes from UTC

Inherited from datetime.tzinfo: __getattribute__, __new__, __reduce__, fromutc, tzname

Inherited from object: __delattr__, __hash__, __reduce_ex__, __setattr__, __str__

Instance Variables [hide private]
  __offset
Number of minutes offset from UTC
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, tzstring)
(Constructor)

 

Initialise a new TzOffset object

>>> TzOffset("+00:00").utcoffset()
datetime.timedelta(0)
>>> TzOffset("-00:00").utcoffset()
datetime.timedelta(0)
>>> TzOffset("+05:30").utcoffset()
datetime.timedelta(0, 19800)
>>> TzOffset("-08:00").utcoffset()
datetime.timedelta(-1, 57600)
Parameters:
  • tzstring (str) - ISO 8601 style timezone definition
Overrides: object.__init__

__repr__(self)
(Representation operator)

 

Self-documenting string representation

>>> TzOffset("+00:00")
TzOffset('+00:00')
>>> TzOffset("-00:00")
TzOffset('+00:00')
>>> TzOffset("+05:30")
TzOffset('+05:30')
>>> TzOffset("-08:00")
TzOffset('-08:00')
Returns: str
String to recreate Node object
Overrides: object.__repr__

dst(self, dt=None)

 
Daylight Savings Time offset
Parameters:
  • dt (Any) - For compatibility with parent classes
Overrides: datetime.tzinfo.dst

Note: This method is only for compatibility with the tzinfo interface, and does nothing

as_timezone(self)

 
Create a human-readable timezone string
Returns: str
Human-readable timezone definition

utcoffset(self, dt=None)

 
Return the offset in minutes from UTC
Parameters:
  • dt (Any) - For compatibility with parent classes
Overrides: datetime.tzinfo.utcoffset