I have this code:
day = int (strftime ("% d"))
month = int (strftime ("% m"))
year = int (strftime ("% Y"))
self.gotit_in = QDateEdit (self.centralwidget, date = QDate (year, month, day), calendarPopup = True)
self.gotit_in.setDisplayFormat ("yyyy-MM-dd")
self.gotit_in.setGeometry (QtCore.QRect (20, 280, 181, 22))
self.gotit_in.setObjectName ("gotit_in")
I read the value of gotit
gotit = self.gotit_in.text ()
print ('gotit' + gotit)
and it prints me correctly the value I want I try to enter the goit value (e.g. '2022-09-14')
query = "INSERT INTO` library` (acquired) VALUES (% s) "% (gotit)
cursor = Functions.DBopen (self, dbname = 'books')
cursor.execute (query)
idx = cursor.lastrowid ()
and I get
File "/usr/local/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 518, in cmd_query
raise errors.get_mysql_exception (exc.errno, msg = exc.msg,
mysql.connector.errors.DataError: 1292 (22007): Incorrect date value: '1999' for column 'acquired' at row 1