SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Question: Filter by date.

Open Samback opened this issue 6 years ago • 1 comments

Hi there, I just wanna filter all dates that older than 24 hours. I was trying to do it like this https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md#date-time-values But it doesn't work for me :(

E.g:

let table = self.table
let boundDate = Date(timeInterval: -86400, since: Date())
let query = table.filter(self.date <= boundDate )
print(query.asSQL())

As a result I get zero items. My SQL query logs print next

SELECT * FROM "logs" WHERE ("date" <= '2019-10-15T18:54:18.109')

What I'm doing wrong?

Samback avatar Oct 16 '19 18:10 Samback

This might be a problem with date formatting (I guess, else I don't know where is the problem) Linked to #985

nathanfallet avatar Aug 23 '21 22:08 nathanfallet