Writing new method to reuse compare the date of two objects with below code
1: public static bool IsSameDayAs(DateTime a, DateTime b)
2: {3: return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day;
4: }So now we can easy use the method like example
1: DateTime regDate = … 2: 3: if(regDate.IsSameDayAs(DateTime.Now)){
4: //do something or alert message
5: }
0 comments:
Post a Comment