Python Forum
[Tkinter] sqlite3 insert date
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] sqlite3 insert date
#1
Hi,

I have a table that has thedate field with text data type. I am trying to insert current date:

    c2.execute("INSERT INTO exam_registration_history VALUES (:name, :exam_type, :token, :taken, :enabled, :thedate)",
        {
            'name': thefullname,
            'exam_type': theexamchoosen,
            'token': '',
            'taken': '',
            'enabled': '',
            'thedate': 'datetime("now")',
        })
i get the string stored as it is datetime("now") and not the date and if I take the quotes datetime('now') i get this error:
Error:
'thedate': datetime("now"), TypeError: an integer is required (got type str)
thanks
Reply
#2
I replaced it with:
date.today()
it is working now.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with PySimpleGUI INSERT INTO sqlite3 database jrbond 5 7,156 Jul-20-2020, 01:24 PM
Last Post: jrbond

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020