Last active
June 1, 2017 10:03
-
-
Save kkappel/9da44054e9720ad97580ed5bf441bdfd 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
| def GetWeek(week_nr, year): | |
| ''' | |
| Get start datetime and end datetime of calender week. | |
| Beginning with Monday, ending with Sunday. | |
| Needed for SQL-Queries. | |
| ''' | |
| montag = str(week_nr) + "-" + str(year) + '-1' | |
| monday = datetime.strptime(montag, '%W-%Y-%w') | |
| sonntag = str(week_nr) + "-" + str(year) + '-0' | |
| tsunday = datetime.strptime(sonntag, '%W-%Y-%w') | |
| sunday = tsunday + timedelta(days=1) | |
| return (monday, sunday) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python Function to get start datetime and end datetime of calender week. Beginning with Monday, ending with Sunday. Needed for SQL-Queries.