MySQL Forums
Forum List  »  Connector/Python

Wrong date format in MYSQL after python insert
Posted by: Razvan Pop
Date: January 22, 2019 03:52PM

Hi,

I have the following code in python to inset data in a MySql table:


sql = "INSERT INTO ap_temp_data (sensor, date, time, temp) VALUES (%s, %s, %s, %s)"
#temp_avalue=read_temp()
val = (sensor, time.strftime("%d.%m.%Y"), time.strftime("%H:%M:%S"), read_temp())
mycursor.execute(sql, val)
mydb.commit()



The problem is that the date for 22.01.2019 in MySql is like that: 2022-01-20

Any idea what is wrong ?

Options: ReplyQuote


Subject
Written By
Posted
Wrong date format in MYSQL after python insert
January 22, 2019 03:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.