I'm writing some scripts that require manipulating what week of the year it is.
My inputs are in the form YYYYWW
, such as '201435'
.
During my attempts to use strptime
it, for some reason, defaults to the first of the year. For example:
import datetime
test = '201435'
test = datetime.datetime.strptime(test,'%Y%U')
print(test)
outputs
2014-01-01 00:00:00
I'm not sure why it's doing so. Using the time
module or replacing %U
with %W
has the exact same result.