How to read datetime back from sqlite as a datetime instead of string in Python?

前端 未结 3 2085
忘掉有多难
忘掉有多难 2020-11-28 03:56

I\'m using the sqlite3 module in Python 2.6.4 to store a datetime in a SQLite database. Inserting it is very easy, because sqlite automatically converts the date to a string

3条回答
  •  长情又很酷
    2020-11-28 04:23

    Note: In Python3, I had to change the SQL to something like:

    SELECT jobid, startedTime as "st [timestamp]" FROM job

    (I had to explicitly name the column.)

提交回复
热议问题