import datetime def get_other_day(mytime, n): y, m, d = mytime.split("-") theday = datetime.datetime(int(y), int(m), int(d)) delta = datetime.timedelta(days=n) other_day = theday - delta other_day = other_day.strftime('%Y-%m-%d') return other_day other_day = get_other_day("2020-2-25", 2) print(other_day)