Skip to main content
Version: 0.5.x

OffsetMonths

The class to offset an input date by some number of months. See Offset... for more details.

Constructor

Creates an OffsetMonths object.

Required Arguments:

  • offset: An integer for the number of months to add

Methods

See Offset... for all methods.

Example

Suppose you have a date that you want to offset by 2 months. This can be done as follows:

from dateutils import OffsetMonths
import datetime

date_modifier = OffsetMonths(offset=2)

input_date = datetime.date(2025, 4, 5)
output_date = date_modifier.modify(input_date)
print(output_date) # prints 2025-06-05