*============================================= FUNCTION WorkDate(d0, nDays0) * Returns the date. For nDays0 not equal zero * the date range d0 - WorkDate(d0, nDays0) * has |nDays0| working days, or * * ABS(nDays0) = WorkDays(d0, WorkDate(d0,nDays0)) * * There is no sense when nDays0 equal zero. In this case * the function returns d0. * * Sergey Karimov LOCAL nDow, nDays nDow= DOW(d0,2) nDays= nDays0 - SIGN(nDays0) RETURN d0 + nDays0 + INT(nDays/5)*2; + IIF(nDays0>0, SIGN(nDays%( 5)+nDow-5.5) + SIGN(7-nDow),; IIF(nDays0<0, SIGN(nDays%(-5)+nDow-0.5) + SIGN(6-nDow),; 1)) - 1 *============================================= FUNCTION WorkDays(d1, d2) * Returns the number of working days (Mondays - Fridays) * in the date range d1 - d2. * * This function evolved from Mike Yearwood's function * WEEKDAYS.PRG, see: * http://www.finn.wikis.com/wc.dll?Wiki~Weekdays~VFP * as well as from its modifications published on * www.levelextreme.com. * * Sergey Karimov LOCAL nDays, nDow nDays= ABS(d1-d2)+1 nDow= 7-DOW(MIN(d1,d2),2) RETURN nDays - INT(nDays/7)*2 - SIGN(nDays%7-nDow) - SIGN(nDow)>Hi All