[파이썬] 날짜 더하는 방법

방법

from datetime import datetime
from dateutil.relativedelta import relativedelta

# 2년 반 후
two_and_half_later = datetime.strptime("2023.01.01", "%Y.%m.%d") + relativedelta(years=2, months=6, days=-1)
print(two_and_half_later)
# => 2025-06-30 00:00:00

links

social