About Date Operations
To get specific weekday of every month, you can use relativedelta
from dateutils
. For example, so you could get the usual day for Django meetup in Berlin which happened to be every second to the last Tuesday of the month:
(env)$ pip install python-dateutil
Then write this Python code:
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta, TU
# the first day of the month
first = date.today().replace(day=1)
# the last day of the month
last = first + relativedelta(months=1) - timedelta(days=1)
# the second to the last Tuesday of the month
tuesday = last + relativedelta(weekday=TU(-2))
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You