I'm digitizing a shapefile in QGIS and I need to create a field that returns automatically the current date.
I'm assuming you want to automatically populate the field with the date at which the feature was edited - apologies if this is not correct.
Create the shapefile and add a field in the attribute table in which to store the date - you should be able to specify "date" as the type of input.
Add the shapefile into QGIS and then open its properties. Under the "field" option you should see a list of the fields in the shapefile, one of these will be your date field. Click the box marked "text edit" (1 in the image below), from the left hand panel select "date" (2), and ensure that "editable" is selected (3). You can set the date format using the various options.
When you create a feature the date field should be automatically populated, although you can also edit this if need be.
You can create a new field with the field calculator and write the current date with a simple SQL command.
- Open the Layer properties
- Enable editing
- open field calculator
- Create a new field using now from the date and time section of the functions
This creates the current date on the new attribute. If you need to write the current date every time you open QGIS you will need another solution The date is not updated everytime but written at the moment of its creation.