Reputation: 1188
The database (SQLite) has a field of type REAL with the values of the form (42153.659595). How to translate this value in the form "dd.MM.yy HH:mm:ss" if 42153.659595 = 29.05.2015 15:49:49 ?
Upvotes: 1
Views: 117
Reputation: 1188
The correct value is achieved using the API/builtin SQL functions (42153.659595 - value from database):
SELECT datetime(julianday(42153.659595, 'localtime') + 2415018.29167) AS DT;
Output:
DT |
2015-05-29 15:49:49|
Constant 2415018.29167 was selected manually and query:
SELECT datetime (2415018.29167);
returns the current Greenwich Mean Time.
I work with a third-party application and documentation on the database is missing. Perhaps this strange decision, but it works. Thank you all for answers.
Upvotes: 0
Reputation: 393457
You can be explicit about what calendar system you require: http://www.sqlite.org/lang_datefunc.html
SELECT julianday('now') - julianday('1776-07-04');
In principle just don't "parse" (you mean: interpret raw representation). Use Sqlite API/builtin SQL functions to do it for you
In the interest of information:
Upvotes: 1