I want to know how to find number of dates between two date by datetimepicker. for Example date range is from 2019.02.22 to 2019.06.19, and i have to find 23th date (2019.02.23/2019.03.23/2019.04.23/2019.05.23) i hope to get result to textbox as 4, however i tried by using below code and got result as 3, it is wrong answer. highly appreciate if anyone can help me on this.
DateTime d5 = dateTimePicker1.Value;
DateTime d6 = dateTimePicker3.Value;
int MonthsElapsednew = ((d5.AddDays(1).Year - d6.AddDays(1).Year)
* 12) +(d5.AddDays(1).Month - d6.AddDays(1).Month)
(d5.AddDays(1).Day < d6.AddDays(1).Day ? 1 : 0);
textBox16.Text = MonthsElapsednew.ToString();