Posted:

**Fri Nov 03, 2006 12:33 pm**I am trying to find a faster way to count weekend days between two dates. My code for this is:

Date StartDate, EndDate; // two dates to calculate # of days

int LoopCounter;

int IntDay;

StartDate = Fdate; //used for this internal method

EndDate = Sdate;

IntDay = Fdate.weekday; // 0=Sunday

while (LoopCounter > 0) {

if ((IntDay == 0) || (IntDay == 6)) {

WEDays = WEDays + 1;

} //end if

This works fine for two dates that are within a year from each other, but when I have two dates that are several years about, it takes up to 20 seconds on my T3.

The internal function for counting the total number of days between two dates is relatively instantaneous. Can I build a similar routine that is just as fast?

Date StartDate, EndDate; // two dates to calculate # of days

int LoopCounter;

int IntDay;

StartDate = Fdate; //used for this internal method

EndDate = Sdate;

IntDay = Fdate.weekday; // 0=Sunday

while (LoopCounter > 0) {

if ((IntDay == 0) || (IntDay == 6)) {

WEDays = WEDays + 1;

} //end if

This works fine for two dates that are within a year from each other, but when I have two dates that are several years about, it takes up to 20 seconds on my T3.

The internal function for counting the total number of days between two dates is relatively instantaneous. Can I build a similar routine that is just as fast?