Logo Home    Page list

Date Last Edited #date #datadefinitions

Although the data definition for EditDate in the PersonTable has been divined for almost as long as this wiki has existed, it seems that no one has published a SQLite query that incorporates it. Here is one that provides the algorithm using SQLite expressions described at http://www.sqlite.org/lang_datefunc.html.
    ,DATE (EditDate + Julianday('1899-12-30')) AS "Last Edited"
FROM PersonTable;
The EventTable uses the same representation but at higher precision, incorporating time, the value to the right of the decimal. With slight modification, the SQLite query for the date and time of the EventTable EditDate becomes:
    ,DATETIME (EditDate + Julianday('1899-12-30')) AS "Last Edited"
FROM EventTable;

The NameTable also is set up with EditDate but all values are 0.0 as of RM

The queries might benefit speed-wise by replacing Julianday('1899-12-30') with 2415018.5.

For updating or inserting records in these tables with timestamps from the operating system, the following queries provide the appropriate timevalues:
-- for PersonTable
SELECT JULIANDAY('now', 'localtime', 'start of day') - 2415018.5 AS EditDate;
-- for EventTable
SELECT JULIANDAY('now', 'localtime') - 2415018.5 AS EditDate;