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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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
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())
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Nov 24
|
107 | ||
|
0
Mar 24
|
128 | ||
|
0
Feb 24
|
312 | ||
|
2
Jul 23
|
1575 | ||
|
0
Dec 22
|
47 |