TransWikia.com

Calculating date field with just a year double field [QGIS]

Geographic Information Systems Asked by Matt Houston on November 4, 2020

I have a dataset in QGIS that I originally created in ArcMap. It has two fields for dates, let’s call them ‘date_from’ and ‘date_to’. Both of these fields contain only a year i.e. ‘2012’ and nothing else, this was originally sufficient for my needs. They are of the double type.

Upon moving over to QGIS I see that dates need to be in the format ‘yyyy-mm-dd’. How would I best go about creating new fields to add the full dates using what I already have? Note that the first of Jan and last of Dec would be sufficient for the new ‘from’ and ‘to’ fields.

One Answer

You can build the full date

to_date( year_from || '-01-01')

to_date( year_to || '-12-31')

enter image description here

enter image description here

Correct answer by JGH on November 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP