Skip to content

Instantly share code, notes, and snippets.

@liladas
Last active September 6, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liladas/4c8a2d441bd9443db305d93a257ab002 to your computer and use it in GitHub Desktop.
Save liladas/4c8a2d441bd9443db305d93a257ab002 to your computer and use it in GitHub Desktop.
datetime from isoweekday
def date_from_day_of_week(isoweekday):
base = datetime.datetime.today()
return [d for d in [base - datetime.timedelta(days=x) for x in range(0, 7)] if d.isoweekday()==isoweekday][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment