Created
September 10, 2017 21:30
-
-
Save Roguelazer/c0bfaacb583d62bdaa24d921ef0b2c79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytz | |
import datetime | |
def starts_of_week(year): | |
start = pytz.UTC.localize(datetime.datetime(year, 1, 1)) + datetime.timedelta(days=(7 - pytz.UTC.localize(datetime.datetime(2017, 1, 1)).isoweekday()) % 7) | |
return [start + datetime.timedelta(days=7*i) for i in range(52)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment