6

I would like to filter on a date value (show only attributes with a date later than 1-1-2000 for example). The field is of QDate type. But doing so I get the message: "Type mismatch or improper type of arguments to > operator". Anyone know how to filter on date?

  • I just tested on QGIS 2.8, and I can filter date expressions like this: "date" > '2015-06-14'. Maybe an issue related to date formats? – ArMoraer Apr 14 '16 at 14:04
  • Probably a version issue. I have 2.14 but cannot. The date in the fields is like this: 2000-01-01, while the values in the query builder appear as 2000/01/01. – Rob Apr 14 '16 at 14:09
  • 2
    I was able to filter using "START_DATE" >'2001-01-01' if I opened the attribute table and used select by expression, but the same expression failed using query builder using QGIS 2.8 – ian Apr 14 '16 at 14:12
6

I was able to filter using "START_DATE" > '2001-01-01' (double quote for Fields and single quote for Variable are important) if I opened the attribute table and used select by expression, but the same expression failed using query builder using QGIS 2.8.

  • 1
    Yes, select by expression works for me too, thanks! However, still interested why filter doesn't work, because filter and select work slightly differently... – Rob Apr 14 '16 at 14:26
  • 1
    The layer level filter is completely out of control of QGIS. It's sent to the dataprovider as is. The expression engine (basically everywhere else you can enter something like SQL in QGIS) is a standadized set of functions. – Matthias Kuhn Apr 14 '16 at 15:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.