doubledate.som#
- doubledate.som(date: date, offset: int = 0) date #
Returns the start of the month for the given
date
, then optionally offsets it byoffset
months.- Parameters:
date (datetime.date) – The date for which to compute the start of the month
offset (int, optional) – The number of months from which to offset the start of the month
- Returns:
The start of the month
- Return type:
datetime.date
Example
>>> today = datetime.date(2020, 1, 15) >>> som(today) datetime.date(2020, 1, 1) #start of the current month
>>> som(today, 1): datetime.date(2020, 2, 1) #first of February
>>> som(today, -1): datetime.date(2019, 12, 1) #start of the previous month
See also
eom
compute the end of the month