I am struggling to subtract two date fields and display the rest in years in a virtual formulae field. Any help much appreciated ...Jon.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Photo of Jon

Jon

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
Here is an example of a formula which determines the number of full years between the date of birth and the policy Date.



var date DOB = [DOB];
var date PolicyDate = [Policy Date];

Year($PolicyDate) - Year($DOB)
-
If(
Month($PolicyDate) < Month($DOB)
or
(Month($PolicyDate) = Month($DOB) and Day($PolicyDate) < Day($DOB)),1,0)


You should be able to modify it to meet your needs based on your field names.  Post back if you get stuck and let me know the field names you are using.