Expand my Community achievements bar.

FormCalc Add five (5) business days to date

Avatar

Level 1

Hey everyone, need some quick help adding business days to the date of another field. I currently only have a simple formula for adding five days to the the other field. Here is what I have. I need Field 2 to calculate 5 business days into the future based off of Field 1. Appreciate the help in advance. I've done a lot of searching around and just can't wrap my head around anything that is said to work.

Field 1: "DateFormCompleted" (User Entered)

Field 2: "RequestedCompletionDate" (Calculated - User Can Override)

Current FormCalc for "RequestedCompletionDate":

Num2Date((Date2Num(DateFormCompleted.formattedValue) + 5))

2 Replies

Avatar

Level 10

Hi there,

a good way to do this, you would need to use the modulus (JavaScript : %, FormCalc : Mod(n1, n2)) to know exactly which day of the week the first date is,

you'll need to do some tests to see which day of the week represents which number... (I think 0 is sunday)

let's say you get a wednesday, you'll know you will need to do +7(weekend) considering +5 business days

Also if you're going in deep, if you have to consider the public holidays, you will have to register the days and then know exactly what is the modulus of that day on 365 for a normal year and 366 for a leap year

I hope this will help you to accomplish what you need...

If you have any other question, feel free to ask

Avatar

Level 8

Mind you that FormCalc is not supported on HTML5 forms. You have to convert to JavaScript.

Tarek