Calculate new date excluding weekends

I need to calculate a new due date based on the creation date to be displayed on the form as a computed field but I have to exclude the weekends.Can someone help me with the code.

This code is with weekend what do I have to do to exclude weekends?


increment:= days

@If(bydate!=“”;bydate;@Text(@Adjust(@Created; 0; 0; increment; 0; 0; 0);“S0”))


the bydate is a date, the user have 2 choices, or enter the date or say within 14 days, and this one is the one i have to adjust and exclude weekends.

Subject: Calculate new date excluding weekends

take a look at @BusinessDays. If I understand your requirement, in your example you want to extend the due date by 14 business days, correct? So find out the number of business days then subtract that from 14 then add the remainder to 14 to get the date that represents 14 business days. will you also need to account for holidays?

Subject: RE: Calculate new date excluding weekends

I should exclude also holidays I have no idea how?

Subject: RE: Calculate new date excluding weekends

use the same function but you will need to tell it what days are your holidays. look it up in designer help.

Subject: RE: Calculate new date excluding weekends

Paul, can you show me one example.

Subject: RE: Calculate new date excluding weekends

http://www-12.lotus.com/ldd/doc/domino_notes/6.5.1/help65_designer.nsf/f4b82fbb75e942a6852566ac0037f284/bd8eac4fb439c6a885256e000049afbc?OpenDocument

Subject: RE: Calculate new date excluding weekends

it gets a bit tricky because when you find a non business day you have to increase your increment. here’s an example but you need to hard code your holidays. I’ve inserted 2 holidays, even though they are not real, just to demonstrate. Paste this code into a button:

holidays := “09/07/2007” : “09/13/2007”;

date := @Date(@Created);

origdate := date;

increment:= 14;

origincrement := increment;

@For(n := 1;

n <= increment;

n := n + 1;

date := @Adjust(date; 0;0;1;0;0;0);

@If(

@Weekday(date) = 1 | @Weekday(date) = 7 | @IsMember(@Text(date); holidays);

increment := increment + 1; “”));

duedate := @Adjust(origdate; 0;0; increment;0;0;0);

@Prompt([Ok]; “Due date …”; "Due date: " + @Text(duedate) + " is " + @Text(origincrement) + " business days out from " + @Text(origdate) + “.”)