I have the date at which a pipe was laid. I want to create a field giving the age of the pipe in years. How do I do this in QGIS?
Asked
Active
Viewed 479 times
3
-
Can you please give an example of age and corresponding year ? – J. Monticolo Apr 08 '19 at 07:19
2 Answers
5
Or use the age function
year(age(now() ,"yourdatefield"))
csk
- 24,827
- 3
- 32
- 70
-
Sometimes I get comfortable using some function and just forget that there might be another one that saves some time... :P – Gabriel Mar 29 '19 at 18:25
2
From the field calculator, this expression could do the trick:
year(now()) - year('the laying date')
Check if the date format will work, but aside from that, it should be pretty easy. The laying date can be replaced by a field value.
Gabriel
- 3,136
- 13
- 33