Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Are you aware the weeks are numbered? There is something like 4th week of the year 2015 and so on. I'd say you should make use of that in your code. You probably need those ranges to comparison. If you really need this, read about datetime.timedelta. Find two Mondays 00:00 and compare the latter one with < instead of <=. Commented Sep 27, 2013 at 6:21
  • @KrzysztofSzularz: And there are at least 3 different rules defining which is the first week in a year in use across the world. Commented Sep 27, 2013 at 6:23
  • @JanHudec, if you operate on datetime objects and are using python's way of determining this you're going to always be right. Commented Sep 27, 2013 at 6:25
  • 1
    strptime is a class method. It will not fill in the remaining fields from the invocant. You have to modify the decomposed date representation yourself. Commented Sep 27, 2013 at 6:27
  • @KrzysztofSzularz: Yes, sure. Commented Sep 27, 2013 at 6:27