I am using QGIS.
I want to filter for all datapoints that were taken over a specific period: 01/01/2015 to 31/12/2015. If I use the 'filter features using form' I can manage this, however I wanted to do it in the Query Builder.
This is the Specific Filter Expression I use:
"Date">'01/01/2015' AND "Date"<'31/12/2015'
(As "Date" is the field column in my data sheet)
When I submit this however, in addition to the second filter I am applying ("Label", and I have no issue with this filter), I find that the date filter has been completely disregarded, and my data is only filtered by "Label".
How do I filter for a specific date duration?
Best Answer
As @Vince already mentioned, this is not a
date
but astring
. You need to convert it to a date first, then you can do the comparison. You can useto_date()
function in field calculator like:so your expression would look something like:
Note that this of course also will only work if your
Date
field is actually adate
and not just anotherstring
. If it is a string as well, you need to convert it to a date first in the same way. E.g.