When specifying a date:
datetime.datetime(2011, 8, 15)
How can i get to know that this is the third week of the month?
What if I wa
To take into account the comment of @Usagi:
datetime.datetime(2011, 8, 15) // should return 3
datetime.datetime(2011, 2, 28) // should return 5
datetime.datetime(2011, 8, 29) // should return 5
The following equation manage that the first day of a month is not necessary a monday:
(d.day-d.weekday() -2)//7+2
The -2 and +2 allow to get a week number between 1 and 6