Last active
August 29, 2015 14:00
-
-
Save amertkara/11008507 to your computer and use it in GitHub Desktop.
This file contains 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
def get_week_day(week_year, week_number, week_day=0): | |
""" For a given year and week_number, gets the day of that particular week | |
If week_year is 2014, week_number is 14 and week_day = 0, | |
it returns datetime.datetime(2014, 4, 6, 0, 0) | |
Args: | |
week_year (int) | |
week_number (int) | |
week_day (int): default is Sunday (0) | |
Returns (datetime): | |
The datetime objects that holds the date with h:m:s as 00:00:00 | |
""" | |
return datetime.strptime(str(week_year) + "-" + str(week_number) + "-" + str(week_day) + " 00:00:00", | |
"%Y-%U-%w %H:%M:%S") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment