콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4558 화면

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
4578
1
3월 15
3882
1
3월 15
31892
0
1월 20
3830
0
6월 19
3524