Hi, I want to store a row in an SQLite 3 table for each booking in my diary.
Each row will have a 'start time' and a 'end time'.
Does any one know how I can query the table for an event at a given time?
E.g. Return any rows that happen at say 10:30am
Thanks
From stackoverflow
-
SQLite3 doesn't have a datetime type, though it does have date and time functions.
Typically you store dates and times in your database in something like ISO 8601 format:
YYYY-MM-DD HH:MM:SS. Then datetimes sort lexicographically into time order.With your datetimes stored this way, you simply use text comparisons such as
SELECT * FROM tbl WHERE tbl.start = '2009-02-01 10:30:00'or
SELECT * FROM tbl WHERE '2009-02-01 10:30:00' BETWEEN tbl.start AND tbl.end;DEzra : Ok, I looked at the link on sqlite site, but I am unclear how to say if the time i am searching for is between startime and endtime. Can you help?
0 comments:
Post a Comment