If I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?
Many thanks
See Question&Answers more detail:osIf I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?
Many thanks
See Question&Answers more detail:os>>> import time
>>> time.asctime(time.strptime('2008 50 1', '%Y %W %w'))
'Mon Dec 15 00:00:00 2008'
Assuming the first day of your week is Monday, use %U
instead of %W
if the first day of your week is Sunday. See the documentation for strptime for details.
Update: Fixed week number. The %W
directive is 0-based so week 51 would be entered as 50, not 51.