Python datetime.strptime month specifier doesn't seem to work

后端 未结 3 1127
北海茫月
北海茫月 2020-12-21 08:17

The month format specifier doesn\'t seem to work.

from datetime import datetime
endDate = datetime.strptime(\'10 3 2011\', \'%j %m %Y\')
print endDate
2011-0         


        
3条回答
  •  情书的邮戳
    2020-12-21 08:55

    %j specifies a day of the year. It's impossible for the 10th day of the year, January 10, to occur in March, so your month specification is being ignored. Garbage In, Garbage Out.

提交回复
热议问题