Search code examples
sqlsqliteairsystem.data.sqlitejulian-date

Sqlite WHERE condition on JULIAN dates?


How to build a sql where clause on a Julian column date?

SELECT * FROM Products WHERE JulianDateColumn > ?

I can't build a working statement I got either no results with a GreaterThan ">" operator or everything with a SmallerThan "<"

I tried with parameters letting Air (Adobe) handle it. I also tried without parameters with string (because of this post):

JulianDateColumn > '2010-04-02 02:02:02' 

or date object

JulianDateColumn > date('now')

All example that I have been able to found, works for date in string (TEXT column) or Unix Time (INTEGER column)

And I can't store my date in any other formats than Julian for compatibility reasons...


Solution

  • ANSWER to my problem :

    SELECT * FROM Products WHERE JulianDateColumn > julianday('now') -1 
    

    And wow! It worked!

    At least building the question has helped me see the obvious!