Datetime strptime in python

后端 未结 5 558
小鲜肉
小鲜肉 2021-02-04 08:30

I\'ve tried the following code :

import datetime
d = datetime.datetime.strptime(\"01/27/2012\", \"%m/%d/%Y\")
print(d)

and the output is :

5条回答
  •  灰色年华
    2021-02-04 09:02

    import datetime
    
    str_time= "2018-06-03 08:00:00"
    date_date = datetime.datetime.strptime(str_time, "%Y-%m-%d %H:%M:%S")
    print date_date
    

提交回复
热议问题