计算使用radMonthYearPicker月份不同 [英] Calculate month different using radMonthYearPicker

查看:262
本文介绍了计算使用radMonthYearPicker月份不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2 radMonthYearPicker(1是起始日期另1是结束日期)
我要计算这个2日期间不同的月份。

我的开始日期,我在我的月设定为DEC和2012年。
我的结束日期,我在我的月设定为DEC和2013年

在此基础上2 RadMonthYearPicker,当月除了应为12个月

只有code我可以找出是RadMonthYearPicker.selectedDate

P.S。我是不允许上传的图像文件,由于缺乏repulation点


解决方案

  INT monthsApart = 12 *(startDate.Year  -  endDate.Year)+
   startDate.Month - endDate.Month;INT结果= Math.Abs​​(monthsApart);

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

解决方案

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

int result = Math.Abs(monthsApart);

这篇关于计算使用radMonthYearPicker月份不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆