code: def randdatetime(self, start=datetime(1970,1,1), end=datetime.now()):
          
          if isinstance(start, str):
              start = self.str2datetime(start)
          if isinstance(end, str):
              end = self.str2datetime(end)
          if start > end:
              raise Exception("start must be smaller than end! your start=%s, end=%s" % (start, end))
          return datetime.fromtimestamp(random.randint(self.totimestamp(start), self.totimestamp(end)))
docs: Generate a random datetime between ``start`` to ``end``.
  
          :param start: Left bound
          :type start: string or datetime.datetime, (default datetime(1970, 1, 1))
          :param end: Right bound
          :type end: string or datetime.datetime, (default datetime.now())
          :return: a datetime.datetime object
          
          **中文文档**
          
          随机生成一个位于 ``start`` 和 ``end`` 之间的时间。