using System; using Microsoft.VisualBasic; public class Test { public static void Main() { DateTime dateBegin = new DateTime(2016,02,27); DateTime dateEnd =new DateTime(2017,02,27); TimeSpan sp = dateEnd - dateBegin; Console.WriteLine(sp.Days); if (DateTime.IsLeapYear(dateEnd.Year)) { if (sp.Days > 366) { Console.WriteLine("Ошибка 365"); } } else { if (sp.Days > 365) { Console.WriteLine( "Ошибка 365"); } } } }