Developing in c#.I have two DateTime objects. I have to eliminate the Saturday and Sunday from the days count. Lets suppose I have 5 daysincluding Saturday and Sunday. I want to check the days for Saturday Sunday and reduces the days count.
DateTime startDate = DateTime.ParseExact(startDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
DateTime endDate = DateTime.ParseExact(endDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
TimeSpan diff = endDate - startDate;
days = diff.Days;
I have tried this,
How can I calculate the Number of Weekends between two dates
but i am unable to eliminate saturday sunday as the given link only eliminate the weekends if the dates difference is greater than 7. Haven't got my solution yet.