# HG changeset patch # User Paul Boddie # Date 1332701064 -7200 # Node ID 34646cfc424eb29ac5b6042364e7b6e0559c76c6 # Parent 73cd25a7f800bca057f033616e60ec5a43499b11 Added support for the production of time strings using hour/minute zone offsets. diff -r 73cd25a7f800 -r 34646cfc424e DateSupport.py --- a/DateSupport.py Sun Mar 25 20:43:22 2012 +0200 +++ b/DateSupport.py Sun Mar 25 20:44:24 2012 +0200 @@ -369,14 +369,19 @@ def __str__(self): return Date.__str__(self) + self.time_string() - def time_string(self): + def time_string(self, zone_as_offset=0): if self.has_time(): data = self.as_tuple() time_str = " %02d:%02d" % data[3:5] if data[5] is not None: time_str += ":%02d" % data[5] if data[6] is not None: - time_str += " %s" % data[6] + if zone_as_offset: + utc_offset = self.utc_offset() + if utc_offset: + time_str += "%02d:02d" % utc_offset + else: + time_str += " %s" % data[6] return time_str else: return "" @@ -390,6 +395,9 @@ self.data[0] ) + tuple(self.data[3:6])) + def as_ISO8601_datetime_string(self): + return Date.__str__(self) + self.time_string(1) + def as_datetime(self): return self