If i understand you well, you want to include the day, which ends time period. So, you have to add 1 to the result.
OriginalGriff has already mentioned that (but in other words) in the comment to his answer.
Quote:
OriginalGriff 2hrs 10mins ago
Reply
[Modify the comment.] [Delete the comment.]
And that is what you get.
30 - 15 == 15
30 - 1 == 29.
Why would you expect it to be any different?
If you want the number of days in a month you need to subtract "first of month A" from "first of month A + 1" not "first of month A" from "last of month A"
Check this:
Dim d1 As DateTime = "01-Sep-2017"
Dim d2 As DateTime = "30-Sep-2017"
Dim result = (d2-d1).TotalDays + 1
Console.WriteLine("The difference between date: {0} and {1} is {2} days.", d1, d2, result)
I strongly suggest to read this:
Performing arithmetic operations with dates and times | Microsoft Docs[
^]