I am using Python 2.7 and I am trying to convert week numbers to actual dates.
I was using this solution which worked fine for basics tests, but I found a case where there seems to be a break: in years with 53 weeks.
The example below shows the issue:
datetime.datetime.strptime( "2015-W53-0", "%Y-W%W-%w").strftime("%Y-W%W-%w")
This returns '2016-W01-0'
, which I think does not make sense.
Is this a known issue, is there a known workaround?
Note that:
datetime.datetime.strptime( "2015-W53-0", "%Y-W%W-%w").isocalendar()
yields (2016, 1, 7)
, so it's probably strptime
which is guessing wrong here.