Skip to content
Advertisement

How to fix ValueError: time data ’18/02/2020 20:14:31′ does not match format ‘%d/%m/%y %H:%M:%S’ in Python?

I am developing a web application with Flask Python. I have a Mysql table with a text column date:

JavaScript

These data above are date in string format. I need to convert these string dates into format dates.

I did this in python :

JavaScript

But I get this error output:

JavaScript

I don’t understand as ’18/02/2020 20:14:31′ corresponding perfectly to format ‘%d/%m/%y %H:%M:%S’

What is wrong in my code? Did I miss something?

Advertisement

Answer

You date format should be

JavaScript

(with Y in upper case)

Advertisement