MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / subtract

Method subtract

src/pendulum/datetime.py:642–665  ·  view source on GitHub ↗

Remove duration from the instance.

(
        self,
        years: int = 0,
        months: int = 0,
        weeks: int = 0,
        days: int = 0,
        hours: int = 0,
        minutes: int = 0,
        seconds: float = 0,
        microseconds: int = 0,
    )

Source from the content-addressed store, hash-verified

640 )
641
642 def subtract(
643 self,
644 years: int = 0,
645 months: int = 0,
646 weeks: int = 0,
647 days: int = 0,
648 hours: int = 0,
649 minutes: int = 0,
650 seconds: float = 0,
651 microseconds: int = 0,
652 ) -> Self:
653 """
654 Remove duration from the instance.
655 """
656 return self.add(
657 years=-years,
658 months=-months,
659 weeks=-weeks,
660 days=-days,
661 hours=-hours,
662 minutes=-minutes,
663 seconds=-seconds,
664 microseconds=-microseconds,
665 )
666
667 # Adding a final underscore to the method name
668 # to avoid errors for PyPy which already defines

Callers 2

_subtract_timedeltaMethod · 0.95
previousMethod · 0.45

Calls 1

addMethod · 0.95

Tested by

no test coverage detected