Date issue with SQLite
General and Desktop
3
Posts
2
Posters
1.0k
Views
1
Watching
-
wrote on 8 Feb 2015, 08:11 last edited by
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?
-
wrote on 8 Feb 2015, 09:17 last edited by
Never mind, I have all the data in the date column in "yyyy-MM-dd" format and now it works as expected.
-
wrote on 9 Feb 2015, 11:38 last edited by
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.
2/3