Is it possible to get the difference (in seconds) between two TIMESTAMP values in Sqlite3?
For instance, I\'ve tried the following query:
SELECT CUR
Another variant to the nearest second
CAST(strftime('%s', CURRENT_TIMESTAMP) as integer) -
CAST(strftime('%s', my_timestamp) as integer)
Got it:
SELECT (julianday(CURRENT_TIMESTAMP) - julianday(my_timestamp)) * 86400.0) FROM my_table;
julianday
returns the fractional number of days since noon in Greenwich on November 24, 4714 B.C. I then take the difference and multiply by the number of seconds per day.