Manage Learn to apply best practices and optimize your operations.

Adjust A Date Forward Any Number Of Business Days

This formula should adjust any given date forward (or backwards) by any given
number of business days. This formula skips weekends (accounting for them in
the adjustment). If you are adjusting a date forward and the date falls on the
weekend, it will be moved back to friday and then adjusted. Likewise, if you
are adjusting a date backwards and the date falls on the weekend, it will be
moved forward to monday and then adjusted.

The variable 'tmpAdjBy' must be an integer value.
The variable 'adjDate' must be a valid date.
tmpAdjBy := +/-??;
adjDate := ??/??/??;

adjUp := tmpAdjBy > 0;
adjBy := @Abs(tmpAdjBy);
preDay := @Weekday(adjDate);
preAdj := @If(preDay = 7; @If(adjUp; -1; 2); preDay = 1; @If(adjUp; -2; 1); 0);
startDate := @Adjust(adjDate; 0; 0; preAdj; 0; 0; 0);
startDay := @Weekday(startDate)-1;
firstAdj := ((((startDay + adjBy) > 5) * adjUp) + (((adjBy - (startDay - 1)) >
0) * !adjUp)) * 2;
adjCnt := ((adjBy - (5 - startDay)) * adjUp) + ((adjBy - (startDay - 1)) *
!adjUp);
secondAdj := @Integer((((adjCnt > 5) * 1) * adjCnt) / 5) * 2;
totalAdj := adjBy + (@If(startDay = @If(adjUp; 5; 1) & adjBy > 5;
(!!@Modulo(adjBy; 5)); 1) * firstAdj) + secondAdj;
ANSWER := @Adjust(startDate; 0; 0; totalAdj * @If(adjUp; 1; -1); 0; 0; 0);

Dig Deeper on Lotus Notes Domino Calendar and Contact Management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close