I am working in python environment. I have a date string which is like this - 26 Apr 2022 17:23:17 GMT
I want to insert this date into mysql where the date column datatype is timestamp. How can I achieve this?
My variables are like this (id=1, name="Jack", date="26 Apr 2022 17:23:17 GMT")
mycurser = mydb.cursor()
sql = "INSERT INTO sample_table (id,name,date) VALUES (%s, %s, %s)"
val = (id, name, date)
mycurser.execute(sql,val)
Here date is string and mysql datatype is timestamp.