Skip to content Skip to sidebar Skip to footer

Sqlite3 Date And Interval Functions

I wonder whether sqlite3 supports interval function. The following statement is accepted by PostgreSQL, however sqlite3 failed to parse it; select ... from orders where ... an

Solution 1:

and o_orderdate < date('1995-03-01', '+3 month')

reference of date and time functions in SQLite

Solution 2:

try this:

and date(o_orderdate) < date('1995-03-01','+3 month')

In order to calculate dates, you must inform to SQLite that your database field is a date: date(o_orderdate)

SQLite syntax is pretty unflexible, so it's important to make sure that the + sign has no spaces to the following number: '+3 month'

Post a Comment for "Sqlite3 Date And Interval Functions"