I researched the internet and found that by adding the following code, I can get the correct number of complete months BUT I DO NOT KNOW WHY.
DateDiff("m",[Start Date],[End Date])+(DatePart("d",[Start Date])>DatePart("d",[End Date]))+1
This is the example:-
Start Date: 15 January 2012
End Date: 14 March 2012
The number of complete months = 1
Expression: DateDiff("m",[Start Date],[End Date])
However, the above expression returns the value = 2
I understand that the first part takes the number of the month (eg. 3 for March, and 1 for January)
Expression: DateDiff("m",[Start Date],[End Date])+(DatePart("d",[Start Date])>DatePart("d",[End Date]))+1
I researched the internet and the above expression gives the correct number of complete months BUT I DO NOT KNOW WHY?
Is it possible that somebody could explain what the DatePart of the expression is doing?
Thanks.
DateDiff("m",[Start Date],[End Date])+(DatePart("d",[Start Date])>DatePart("d",[End Date]))+1
This is the example:-
Start Date: 15 January 2012
End Date: 14 March 2012
The number of complete months = 1
Expression: DateDiff("m",[Start Date],[End Date])
However, the above expression returns the value = 2
I understand that the first part takes the number of the month (eg. 3 for March, and 1 for January)
Expression: DateDiff("m",[Start Date],[End Date])+(DatePart("d",[Start Date])>DatePart("d",[End Date]))+1
I researched the internet and the above expression gives the correct number of complete months BUT I DO NOT KNOW WHY?
Is it possible that somebody could explain what the DatePart of the expression is doing?
Thanks.