def _getActivity(self, id): try: activity = self.activities[id] # activity will be modified - update creation time activity.CreationTime = datetime.datetime.now(localtzoffset()) except KeyError: activity = self._queryActivity(id) return activity
def _getDateTime(self, dt_str): # Example: 06/10/2012 16:17:41 m = re.search("(\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+)", dt_str) if m is None: raise StepError("can't parse '%s' as a date/time" % dt_str) month = int(m.group(1)) day = int(m.group(2)) year = int(m.group(3)) hour = int(m.group(4)) minute = int(m.group(5)) second = int(m.group(6)) return datetime.datetime(year=year, month=month, day=day, hour=hour, minute=minute, second=second, tzinfo=localtzoffset())
def _getDateTime(self, dt_str): # Example: 06/10/2012 16:17:41 m = re.search("(\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+)",dt_str) if m is None: raise StepError("can't parse '%s' as a date/time" % dt_str) month = int(m.group(1)) day = int(m.group(2)) year = int(m.group(3)) hour = int(m.group(4)) minute = int(m.group(5)) second = int(m.group(6)) return datetime.datetime(year=year, month=month, day=day, hour=hour, minute=minute, second=second, tzinfo=localtzoffset())
def _getDateTime(cls, dt_str): # Example: Fri May 30 06:54:25 2008 (day of the month isn't padded) dt = datetime.datetime.strptime(dt_str, "%a %b %d %H:%M:%S %Y") return dt.replace(tzinfo=localtzoffset())
def _getDateTime(cls, dt_str): # Example: Fri May 30 06:54:25 2008 (day of the month isn't padded) dt = datetime.datetime.strptime(dt_str,"%a %b %d %H:%M:%S %Y") return dt.replace(tzinfo=localtzoffset())