Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4546 Zobrazení

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  

Avatar
Zrušit
Nejlepší odpověď

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())
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
srp 25
560
1
bře 25
1542
0
bře 24
1021
0
úno 24
1240
2
čvc 23
3002