System.DateTime birthday = DateTime.Parse("2/9/2012 10:10:11 AM"); var nextBirthday = birthday.AddYears(DateTime.Today.Year - birthday.Day); var recentBirthday = birthday.AddMonths(DateTime.Today.Month - birthday.Month); if (recentBirthday<DateTime.Today) { recentBirthday = recentBirthday.AddMonths(1); } if(nextBirthday < DateTime.Today) { nextBirthday = nextBirthday.AddYears(1); }
DateTime dtStart = new DateTime(2017, 3, 25); DateTime dtEnd = DateTime.Now.Date; TimeSpan diff = dtEnd - dtStart; Console.WriteLine(diff.TotalDays);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)