teoh <[EMAIL PROTECTED]> writes: > does that mean. i just create "timedate int" in sql. > and use unixepox to store the date+time inside it. > and query it using unixepox for range ?
Yes, approximately. Note that the specified type is unimportant here. In the following example, I use "TIMESTAMP" but it could as well be "INTEGER". sqlite> CREATE TABLE x(id INTEGER PRIMARY KEY, ts TIMESTAMP); sqlite> INSERT INTO x VALUES (NULL, strftime('%s', 'now')); sqlite> -- I am waiting a few seconds here sqlite> INSERT INTO x VALUES (NULL, strftime('%s', 'now')); sqlite> -- I am again waiting a few seconds here sqlite> INSERT INTO x VALUES (NULL, strftime('%s', 'now')); sqlite> .mode line sqlite> SELECT * from x; id = 1 ts = 1106849717 id = 2 ts = 1106849736 id = 3 ts = 1106849752 sqlite> -- get entries inserted in last 120 seconds sqlite> SELECT * FROM x WHERE ts >= strftime('%s', 'now') - 120; id = 1 ts = 1106849717 id = 2 ts = 1106849736 id = 3 ts = 1106849752 sqlite> -- I am waiting a litte while to let some of these time out. sqlite> -- again get entries made in last 120 seconds sqlite> SELECT * FROM x WHERE ts >= strftime('%s', 'now') - 120; id = 3 ts = 1106849752 sqlite>