I have a shapefile with polygons. Each polygon contains a date (fully written in text, for example: '2 june 2018') in the attribute table. This field is format 'text'. Now, I would like to convert these fields / this column to a new column with the dates written in numbers (for example '02/06/2018'). The new fields have to be formatted as 'date'.

Does anybody know how to do this quickly in the field calculator using a formula?


1 Answer 1


First I'd like to note that only the international date format is of type "date": yyyy-mm-dd. All other types are just representations of this date and depend e.g. on your settings about locales in QGIS. You can change these in Settings --> Options --> General. That being said, you can use this expression:

 to_date('2 june 2018', 'd MMMM yyyy', 'en')

respectively replace the date with your field.

  • Hi MrXsquared, works perfectly! Although I changed the 'en' to 'nl', because the names of the months are written in Dutch. Works! Thanks!!
    – BramV
    Commented Sep 5, 2023 at 11:44

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.