效果如下:
代码:
def getXmonthafter(months,date_=None):
if date_ is None:
date_=datetime.date.today()
yeardelta=(date_.month+months-1)//12
newmonth=(date_.month+months-1)%12+1
return datetime.date(date_.year+yeardelta,newmonth,1)
参考:
https://www.cnblogs.com/symons1992/p/5944445.html
如有错误或不足欢迎指正