Check if the given date is listed as holiday or not?

Posted by Vishalneeraj-24503 under Visual Studio category on | Points: 40 | Views : 1216
We have DayOfWeek in-built property of Date class and DayOfWeek enum which has Sunday,Monday,Tuesday and so on. value through which we can check as:-
If DayOfWeek is Saturday or Sunday then it's Holiday.
public static bool IsHoliday(this DateTime Date)
if (Date.DayOfWeek == DayOfWeek.Saturday || Date.DayOfWeek == DayOfWeek.Sunday)
return true;
return false;

Comments or Responses

Login to post response