跳至内容
菜单
此问题已终结
2 回复
4316 查看

how can we increase the number of months of a date with a value in a function !! please heeelp

形象
丢弃
最佳答案

Hi,

from datetime import datetime
from dateutil.relativedelta import relativedelta

def _add_month_date(self, date_octroi,nbr_echeance) :
    date_before_month = datetime.strptime(date_octroi, '%Y-%m-%d') 
    date_after_month = date_before_month+ relativedelta(months=nbr_echeance)
    return  date_after_month

This function takes as parameters your date and number of months and add return months to this date then return a new date.

thanks.

形象
丢弃
编写者 最佳答案

Thank you so so much for your reply and sorry if I was'nt too clear.. But I want to say that I have already a "date_octroi" for which I need to increase the number of months with the value of the number of deadlines "nbr_echeance"... how can i do it !! please i need your help thanks a lot

形象
丢弃

I edit my answer it is clear now.

编写者

yes it's so perfect thank you so much :-)

相关帖文 回复 查看 活动
1
1月 24
4342
1
3月 15
3739
1
3月 15
31612
0
1月 20
3624
0
6月 19
3303