Skip to content

Instantly share code, notes, and snippets.

@judy2k
Created January 9, 2016 11:54
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 judy2k/7f7ed5590aedf0615720 to your computer and use it in GitHub Desktop.
Save judy2k/7f7ed5590aedf0615720 to your computer and use it in GitHub Desktop.
Find the next weekday after the given date.
from datetime import date, timedelta
def next_weekday(d):
wd = d.weekday()
return d + timedelta(days=1 if wd < 4 else 7 - wd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment