Date Last Edited #date #datadefinitions

Decode the Last Edited Date for Persons

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.

SELECT PersonID
    ,EditDate
    ,DATE (EditDate + Julianday('1899-12-30')) AS "Last Edited"
FROM PersonTable;

Decode the Last Edited DateTime for Events

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:

SELECT EventID
    ,EditDate
    ,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 6.0.0.4.

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

Encoding System DateTime To Update EditDate

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;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.