Forum Discussion
QuickBaseCoachD
6 years agoQrew Captain
I have not tested this lately, but I had it saved in my cheat notes. Let me know if it tests OK.
var date SD= Today();
var date ED= IF(Year([Expiration date])<> Year(Today()), Date(Year(Today()),12,31), [Expiration date]));
(Year($ED)-Year($SD)-1)*12 // start off with 12 times the number of fully completed years
+If(Month($ED)>=Month($SD),12,0) //add 12 months if the last year was fully completed
+ If((Month($ED)>=Month($SD)),Month($ED)-Month($SD),12+Month($ED)-Month($SD)) // add the number of months between the month numbers.
-If(Day($ED)<Day($SD),1,0) // but if the day did not catch up to the start date's day number, then subtract 1.
var date SD= Today();
var date ED= IF(Year([Expiration date])<> Year(Today()), Date(Year(Today()),12,31), [Expiration date]));
(Year($ED)-Year($SD)-1)*12 // start off with 12 times the number of fully completed years
+If(Month($ED)>=Month($SD),12,0) //add 12 months if the last year was fully completed
+ If((Month($ED)>=Month($SD)),Month($ED)-Month($SD),12+Month($ED)-Month($SD)) // add the number of months between the month numbers.
-If(Day($ED)<Day($SD),1,0) // but if the day did not catch up to the start date's day number, then subtract 1.