Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How Do I Get the Number of Months Between Two Dates?

Hi all,

I am still lost in number of months between dates expression.

Being New to QV & Scripting but is been like thrown into the deep end.

this question was raised by @Jonathan Shaltz earlier

  Data set i have:

Start DateCompleted Date
21-Mar-199731-Dec-2030
01-Jun-201031-Dec-2030
10-May-201331-Dec-2030

  1. find the number of months between the dates
  2. find the number of Years between the dates
  3. Do not load/(drop) data below certain year stamp

How Do I Get the Number of Months Between Two Dates.jpg

@Jonathan Shaltz

2 Replies
atoz1158
Creator II
Creator II

Hi Tony

Try replacing your highlighted line with the following

((Year([Completed Date])*12) + Month([Completed Date])) - ((Year([Start Date])*12) + Month([Start Date])) As MonthDiff,

Anonymous
Not applicable
Author

Hi Adrian,

thanks so much

Tony