Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating Months

Tags:

vb.net

I have an application where the user selects the dates of a first statement and a last statement. Example, first statement = 1/1/08, last statement = 12/1/08, should equal 12 statements.

However, when using the following code, the result is 11:

numPayments = DateDiff(DateInterval.Month, CDate(.FeeStartDate), CDate(.FeeEndDate))

Is there another way to calculate this, or do I have to be stuck with adding 1 to the result?

like image 747
joek1975 Avatar asked Apr 08 '26 05:04

joek1975


1 Answers

Add 1, as you write. ;)

The difference between 1/1/2008 and 12/1/2008 is 11 months. No changing that. ;)

like image 63
Jason Avatar answered Apr 12 '26 10:04

Jason



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!