How do we find if any day in calendar year is a weekend or not.
I checked other thread but all solution were specific to current day using now.DayofWeek.ToString().
Let’s say with some calculation my resultant date is 2nd Feb 2019. Now how to check if this is weekend or not.
If you have a valid date string(“02-02-2019”) and not a DateTime object, convert it to a DateTime object first (You can use DateTime.Parse(“02-02-2019”) or Convert.ToDateTime(“02-02-2019”), and store it in a variable (say dtDate)).
Now, once you have the date as a DateTime object, the following shall do the trick for you:
dtDate.DayOfWeek.ToString.
What’s next is to check if it’s equal to a “Saturday” or a “Sunday”. That’s it. Try it and let me know if it worked.