标签:ram datetime int diff 之间 summary private returns date
/// <summary>
/// 获取2个时间之间的月份差
/// </summary>
/// <param name="d1"></param>
/// <param name="d2"></param>
/// <returns></returns>
private int MonthDiff(DateTime d1, DateTime d2)
{
DateTime max = d1 > d2 ? d1 : d2;
DateTime min = d1 > d2 ? d2 : d1;
int yeardiff = max.Year - min.Year;
int monthdiff = max.Month - min.Month;
return yeardiff * 12 + monthdiff + 1;
}
标签:ram datetime int diff 之间 summary private returns date
原文地址:http://www.cnblogs.com/ChinaZhao/p/7504123.html