datetime.timedelta() method returns an object representing a duration, resolved to microseconds, that occurs between
datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
All of the parameters are optional and default to zero.
We can perform different operations on a
For example, if we want to add 2 months to the current date, it can be done as below:
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
Learn Python on Codecademy
Computer ScienceLooking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
Includes 6 Courses
With Professional Certification