Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I calculate the diff. between 2 dates and remove the weekends?

Status
Not open for further replies.

Brix

Programmer
Jan 25, 2002
3
0
0
DE
Hi experts,

I calculate the difference between 2 given dates with the following formula:

temp := (ITEndtermin-ITStarttermin)/(60*60);
tage := @Integer(temp / 24);
stunden := @Modulo (temp;24);
@If(@IsError(temp); ""; @Text(Tage) + " Tag(e) " + @Text(stunden) + " Stunden")

I need to calculate the daydifference without weekends.

Can you help me please?

Thanks in advance

Peer
 
I found this formula on a Notes help database, and have used it successfully.

REM "Subtracts weekend days";
REM "WARNING:: you should verify that firstdate and nextdate are not Sat. or Sun.";
REM "Required Field(s): NextDate, FirstDate ";
temp := (@Date(nextdate) - @Date(firstdate)) / 86400;
weekend_days := @Integer((temp / 7)) * 2;
wkday := @Weekday(firstdate);
adjust := @If(((wkday + @Modulo(temp; 7) - 7) > 0); 2; 0);
working_days := temp - (weekend_days + adjust);
working_days

 
hi hilaryb,

thank u very much 4 ur quick responding reg. my question. let me tell u that it works perfect.

again ... thank u very much :))

greetz

peer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top