Odoo Help

0

Date Difference in Days

By
ca.anil.kumar@gmail.com
on 12/1/16, 12:50 AM 239 views

Could you please give an exact/complete code for finds date difference in days. The idea is we are using membership module and we want to display still how many days remain before membership expires.

Thank you  

0
zarzarsan
On 12/1/16, 3:11 AM

You can use this date difference.

from datetime import datetime,date,timedelta
from dateutil.relativedelta import relativedelta
today = datetime.now()
today_str = today.strftime("%Y-%m-%d")
diff = relativedelta(datetime.strptime(today_str,'%Y-%m-%d').date(),datetime.strptime(your_date,'%Y-%m-%d').date())

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)

Stats

Asked: 12/1/16, 12:50 AM
Seen: 239 times
Last updated: 12/1/16, 3:11 AM