CSharp examples for System:DateTime Day
Determines whether the two dates are on the same day.
using System;//from ww w.j av a 2 s. c o m public class Main{ /// <summary> /// Determines whether the two dates are on the same day. /// </summary> /// <remarks> /// This is a convenience / safety method for LINQ which can hiccup with date comparisons in lambdas. /// </remarks> /// <param name="date1">The first date.</param> /// <param name="date2">The second date.</param> /// <returns><c>true</c> if date1 and date2 occur on the same date, <c>false</c> otherwise.</returns> public static bool AreSameDate(DateTime date1, DateTime date2) { return date1.Date == date2.Date; } }