def get_date_generator(self, outputType=EPOCH_TYPE): # Set Output Function if outputType==DATETIME_TYPE: outputFn = lambda d: d elif outputType==EPOCH_TYPE: outputFn = dt_datetime_to_epoch elif outputType==DATESTRING_TYPE: outputFn = lambda d: strftime(d, '%Y-%m-%d') else: raise NameError # Yield Dates currentDT = self.startDT while currentDT < self.endDT: yield outputFn(currentDT) if self.periodicity == SECONDS: currentDT = dt_add_seconds(currentDT, 1) elif self.periodicity == MONTHS: currentDT = dt_add_months(currentDT, 1) elif self.periodicity == QUARTERS: currentDT = dt_add_months(currentDT, 3) elif self.periodicity == YEARS: currentDT = dt_add_months(currentDT, 12) else: raise NotImplementedError # Yield End yield outputFn(self.endDT)
def fset(self, value): if type(value) is not datetime.datetime: raise TypeError self._endDT = value self._endEpoch = dt_datetime_to_epoch(value) self._endYMD = strftime(self._endDT, '%Y-%m-%d')
def fset(self, value): if type(value) is not int: raise TypeError self._endEpoch = value self._endDT = dt_epoch_to_datetime(value) self._endYMD = strftime(self._endDT, '%Y-%m-%d')