0

Using ajax calendar can i write a program to know the number of working days in a given month...if yes how???
I should be able to show the number of working d
ays in a text box..when i select a given month

HELP IS APPRECIATED

THANX IN ADVANCE

Edited by RAMAN2233: n/a

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by dollarcolony
0

You're on your own for holidays, though; .NET doesn't know which dates are holidays where you live.

int days = 0;
            DateTime sdt = DateTime.Parse("2/1/2009");
            DateTime edt = DateTime.Parse("2/28/2009");
            int dowStart = ((int)sdt.DayOfWeek == 0 ? 7 : (int)sdt.DayOfWeek);
            int dowEnd = ((int)edt.DayOfWeek == 0 ? 7 : (int)edt.DayOfWeek);
            TimeSpan tSpan = edt- sdt;
            if (dowStart <= dowEnd)
            {
                days= (((tSpan.Days / 7) * 5) + Math.Max((Math.Min((dowEnd + 1), 6) - dowStart), 0));
            }
            else
            {
                days=(((tSpan.Days / 7) * 5) + Math.Min((dowEnd + 6) - Math.Min(dowStart, 6), 5));
            }
0

Just try this simple code in javascript

var startDate = new Date(startdt);
var EndDate = new Date(endDt);
var WorkingDayCount=0;

if(startDate < EndDate)
{
if(startDate.getDay() != 0 && startDate.getDay() !=6)
{
WorkingDayCount++
}
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.