Cannot parse the date in Python

前端 未结 3 886
挽巷
挽巷 2020-12-12 04:27

I need to parse date and time. Here is what I\'ve got:

import time
a = time.strptime(\'Apr 28 2013 23:01\', \"%b %d %y %H:%M\")
print a 

Bu

3条回答
  •  醉酒成梦
    2020-12-12 05:23

    You can

    import time
    a = time.strptime('Apr 28 2013 23:01', "%b %d %Y %H:%M")
    print time.strftime("%d/%m/%Y",a)
    

    with Y. It is followed by a conversion line of code, and gives result

    28/04/2013

提交回复
热议问题