Here's a created list of dates (before and after today) and a way to calculate the offset days relative to today ("now") and alert at a set interval:
On Wednesday, 25 July 2018 21:12:54 UTC+2, deepak madan wrote:
-- from __future__ import print_function
import datetime
now = datetime.datetime.now()
dates = []
for d in range(7, 0, -1):
dates.append(datetime.datetime.now() - datetime.timedelta(days=d))
for d in range(1, 8):
dates.append(datetime.datetime.now() + datetime.timedelta(days=d))
for _date in dates:
diff = _date - now
print(_date.strftime('%Y%m%d'), diff.days)
if diff.days == 3:
print('Alert @ 3 days!')
On Wednesday, 25 July 2018 21:12:54 UTC+2, deepak madan wrote:
HOW to find the difference between a list of dates and today and find the difference matches some days difference. Help
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/146e56b9-31b6-4fa4-9c08-4947dd75a087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment