1

Exact Duplicate of Calculate month different using radMonthYearPicker

I have 2 radMonthYearPicker(1 is for start Date another 1 is for end Date) I want to calculate the month different between this 2 date.

for my start Date, I set my month as dec and year 2012. for my end Date, I set my month as dec and year 2013

Base on this 2 RadMonthYearPicker, the month apart should be 12 month

The only code I can find out is RadMonthYearPicker.selectedDate

P.S. I was not allow to upload image file due to lack of repulation point

Community
  • 1
  • 1
user1861753
  • 91
  • 1
  • 3
  • 11

2 Answers2

0
            int monthApart = 12 * (RMYP_startDate.SelectedDate.Value.Year - RMYP_endDate.SelectedDate.Value.Year) +
        RMYP_startDate.SelectedDate.Value.Month - RMYP_endDate.SelectedDate.Value.Month;
user1861753
  • 91
  • 1
  • 3
  • 11
-1

I believe this will work for you

var monthDifference = ((startDate.selectedDate.Year - endDate.selectedDate.Year) * 12) + startDate.selectedDate.Month - endDate.selectedDate.Month

Difference in months between two dates

Community
  • 1
  • 1
msigman
  • 4,474
  • 2
  • 20
  • 32