Important: Please read the Qt Code of Conduct -

Date issue with SQLite

  • Hi,

    I have a database application in Qt and it uses SQLite. In the beginning, I stored all the dates as string in the database in "dd.MM.yyyy" format. Now, I need to use the following SQL statement but it doesn't work out:

    @SELECT sold_date, title, sold_price FROM adv WHERE userid=2 AND sold_date > '01/01/2015'

    Is there any way to convert my column to a comparable format in an easy way? Otherwise I need to change the format to another one that SQLite understands I suppose. Could anyone help me out?

  • Never mind, I have all the data in the date column in "yyyy-MM-dd" format and now it works as expected.

  • The default date format is YYYY-MM-DD only. So write a small code to change the format of the value, then change the data type of the column.

Log in to reply