If only timedelta had a month argument in it\'s constructor. So what\'s the simplest way to do this?
EDIT: I wasn\'t thinking too hard about this as was poin
import datetime date_str = '08/01/2018' format_str = '%d/%m/%Y' datetime_obj = datetime.datetime.strptime(date_str, format_str) datetime_obj.replace(month=datetime_obj.month-1)
Simple solution, no need for special libraries.