1

I would like to calculate the number of days between two dates. The first date is written in attribute table [YYYY-MM-DD] (creation date) and the second is today [now()]. The goal is, to get the age of every feature. I need it as QGIS expression to create a virtual field.

date1 (attribute in table) - now() = age (as virt. field)
1

You can compute the duration between the two dates using the age function. Since it returns a timespan, you can then extract the number of days from it.

day(age(now(),"creation_date"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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