c#获得两个时间的月的差值
2021-03-26 05:25
标签:time start end star span 获得 art bsp int c#获得两个时间的月的差值 标签:time start end star span 获得 art bsp int 原文地址:https://www.cnblogs.com/bsdbqling/p/9396230.htmlC# codeDateTime startDate = DateTime.Parse("2008-1-1");
DateTime endDate = DateTime.Parse("2010-10-31");
int totalMonth = endDate.Year * 12 + endDate.Month - startDate.Year * 12 - startDate.Month;
C# codeDateTime startDate = DateTime.Parse("2008-1-1");DateTime endDate = DateTime.Parse("2010-10-31");int totalMonth = endDate.Year * 12 + endDate.Month - startDate.Year * 12 - startDate.Month;