def _parse_date(self): #TODO: Check if Date Object, and other Formats date = self.date offset = self.offset if type(date) == types.StringType: offset = date[-6:] # if offset is of correct format # initiate variables in class if zone._match_offset(offset) is True: self.date = date[:-6] self.offset = offset
'''parse date and get offset information''' def _parse_date(self): #TODO: Check if Date Object, and other Formats date = self.date offset = self.offset if type(date) == types.StringType: offset = date[-6:] # if offset is of correct format # initiate variables in class if zone._match_offset(offset) is True: self.date = date[:-6] self.offset = offset #Test if (__name__ == '__main__') : print print "-- time_coordinator.py" TC = TimeCoordinator('2011-10-05 09:02:55-07:00') print "Date: " + str(TC.date) print "Offset: " + str(TC.offset) print zone._match_offset(TC.offset) print TC.convert_date_to_local() print "--" TC = TimeCoordinator('2011-10-12 22:30:54') print "Date: " + str(TC.date) print "Offset: " + str(TC.offset) print zone._match_offset(TC.offset) print TC.convert_date_to_local() print "--"