I am trying to convert the string '2012-11-14 14:32:30'
to datetime.datetime
object via datetime.datetime.strptime
method using format string '%Y-%m-%d %H:%M:%S'
.
Doing this, I get an error:
ValueError: time data '%Y-%m-%d %H:%M:%S' does not match format
'2012-11-14 14:32:30'
The correct syntax is:
datetime.strptime('2012-11-14 14:32:30', '%Y-%m-%d %H:%M:%S')
so first the string, then the format.
Read aloud:
ValueError: time data '%Y-%m-%d %H:%M:%S' does not match format '2012-11-14 14:32:30'
ValueError: time data '2012-11-14 14:32:30' does not match format '%Y-%m-%d %H:%M:%S'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With