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
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())
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati| Post correlati | Risposte | Visualizzazioni | Attività | |
|---|---|---|---|---|
|
0
ago 25
|
2040 | |||
|
1
mar 25
|
3436 | |||
|
0
gen 26
|
2117 | |||
|
0
feb 24
|
2493 | |||
|
2
lug 23
|
4368 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.