1

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

user1861753
  • 91
  • 1
  • 3
  • 11

1 Answers1

0
int monthsApart = 12 * (startDate.Year - endDate.Year) + 
   startDate.Month - endDate.Month;

int result = Math.Abs(monthsApart);
Win
  • 61,100
  • 13
  • 102
  • 181
  • 1
    To clarify Win's answer: `startDate` should be used as `RadMonthYearPicker1.SelectedDate` where `RadMonthYearPicker1` should be replaced by the name you gave to your "start date" control. Same should be done with the control used for "end date". – Francis P Dec 10 '12 at 19:17