code: def truncate(self, percentage):
          
  
          self.validate_time_inversion()
  
          if percentage < 0:
              raise ValueError("discard_percent must be greater or equal to zero: " + str(percentage))
  
          if percentage == 0:
              return
  
          discard_time = self.timedelta // int(100) * int(percentage / 2)
  
          self.__start_datetime += discard_time
          self.__end_datetime -= discard_time
docs: Truncate ``percentage`` / 2 [%] of whole time from first and last time.
  
          :param float percentage: Percentage of truncate.
  
          :Sample Code:
              .. code:: python
  
                  from datetimerange import DateTimeRange
                  time_range = DateTimeRange(
                      "2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
                  time_range.is_output_elapse = True
                  print(time_range)
                  time_range.truncate(10)
                  print(time_range)
          :Output:
              .. parsed-literal::
  
                  2015-03-22T10:00:00+0900 - 2015-03-22T10:10:00+0900 (0:10:00)
                  2015-03-22T10:00:30+0900 - 2015-03-22T10:09:30+0900 (0:09:00)