代码如下: public static string DateDiff(DateTime DateTime1, DateTime DateTime2) { string dateDiff = null; int date = 0; try { int year = Convert.ToInt32(DateTime2.ToString(“yyyy”)) – Convert.ToInt32(DateTime1.ToString(“yyyy”));