On 8/28/2013 5:04 PM, Thomas Jarosch wrote:
consider this stripped-down database:

------------------
CREATE TABLE "horde_alarms" ("id" INTEGER PRIMARY KEY, "alarm_end" datetime);
INSERT INTO "horde_alarms" VALUES(1, '2013-08-28 22:00:00');
------------------


These queries work fine:
------------------
sqlite> SELECT * FROM horde_alarms WHERE alarm_end < '2013-08-28T23:08:48';
1|2013-08-28 22:00:00

sqlite> SELECT * FROM horde_alarms WHERE alarm_end > '2013-08-28 18:08:48';
1|2013-08-28 22:00:00
------------------

SQLite doesn't have "datetime" data type. All these values are plain strings, and are compared as such. It just so happens that, if you use a suitable format consistently, usual string comparisons also order dates and times correctly.

So, don't mix and match the format with and without T in the middle. Choose one, and stick to it.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to