Cannot parse the date in Python

前端 未结 3 855
挽巷
挽巷 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:07

    %y should be %Y for a 4 digit year...

    From the docs:

    %y  Year without century as a decimal number [00,99].    
    %Y  Year with century as a decimal number.
    

提交回复
热议问题