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
4452 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
čvc 25
446
1
bře 25
1402
0
bře 24
960
0
úno 24
1152
2
čvc 23
2906