In QGIS, I would like to create a rule-based on dates for some vector points. These points have a field for dates, in the format dd/mm/yy. The rule would be such that if a date is less than a certain date then I expect to see one symbol and if not then another symbol. How can achieve it?

1 Answer 1


We are starting from a common issue here: your date is not a date. It is a string representing a date. And strings cannot be compared by smaller than, less than or similar operators. Another issue is that you cannot specify the century, by giving only the last two numbers of the year. By default QGIS interprets this as 19xx. So you need to add or substract the centuries to your year.

You can do the following:

  1. Convert your string to a date via to_date("yourstringdatefield",'dd/MM/yy')
  2. Add or substract a century: to_date("yourstringdatefield",'dd/MM/yy') + to_interval('100 years')
  3. Compare it, e.g. to_date('24/09/2019','dd/MM/yyyy') < (to_date("yourstringdatefield",'dd/MM/yy') + to_interval('100 years'))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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