[Qgis-user] Filter syntax for date fields

Patrick Dunford blackwhitekez at gmail.com
Thu Oct 19 19:30:29 PDT 2017


I have a shapefile table with 300,000 records of polygons that I want
to filter for display on the map canvas. I want to use the field called
"date" which is defined as a Qdate in the fields list in the
shapefile's properties.

The question is how to put in the filter string in the correct syntax
to give me for example all the records that are for the calendar year
of 1984.

For example
 year("date") = 1984
will not work because it doesn't accept the year function from the list
of functions that are available in other expression editors which allow
a function list to be used.

In a previous version of this table I had it was actually quite easy
because the dates were input as a string and the like operator could be
used. It seems with a date that is actually defined as a date field
there is no obvious or easy way to input a range of dates (how do you
put in a date constant) or use a function that will extract part of a
date from a date field.




More information about the Qgis-user mailing list