Why is datetime.strptime not working in this simple example?

前端 未结 6 1166
轻奢々
轻奢々 2020-12-08 09:24

I\'m using strptime to convert a date string into a datetime. According to the linked page, formatting like this should work:

>>> # Usi         


        
6条回答
  •  孤城傲影
    2020-12-08 09:57

    You should use strftime static method from datetime class from datetime module. Try:

    import datetime
    dtDate = datetime.datetime.strptime("07/27/2012", "%m/%d/%Y")
    

提交回复
热议问题