business days calculation

Hi guys,

Need help AGAIN. I have 2 fields. Date issued and Date Due.

I need the Date Due field to be a calculation of always +10 BUSINESS days from the date issued. I’m sure it’s a very common problem. Any tips on how this can be easily done? (Saturday,Sundays are the non-business days)

thanks

Hi Sammy

Haven’t got a calc available but if:

start_date.getDay() = 2 then +12 days (day 2 = Monday so only one weekend)
start_date.getDay() = 3,4,5 or 6 then +14 days (Tuesday to Friday so two weekends)

This off top of head so worth checking - and assumes start_date will not be a Saturday or Sunday - but should get you started.

Regards

Graham Greensall
Worxinfo Ltd

Hi Sammy,

have a look at this thread: Calculating weekends and public holidays - Classic Servoy - Servoy Community

It has a formula for resolving the number of working days between a start and end date

Cheers
Harry

Hi Sammy,

Sorry I completely misread your post and gave you a link to duration between two dates.

You just need a date plus x days.

Try the following in a calculation:

switch( date_issued.getDay() )
{
	case 0 :
		var d =  date_issued.setDate(date_issued.getDate() + 12);
		break;
	case 6 :
		var d =  date_issued.setDate(date_issued.getDate() + 13);
		break;
	default:
		var d =  date_issued.setDate(date_issued.getDate() + 14);
};

return d

Cheers
Harry

Harry Catharell:
Hi Sammy,

Sorry I completely misread your post and gave you a link to duration between two dates.

You just need a date plus x days.

Try the following in a calculation:

switch( date_issued.getDay() )

{
case 0 :
var d = date_issued.setDate(date_issued.getDate() + 12);
break;
case 6 :
var d = date_issued.setDate(date_issued.getDate() + 13);
break;
default:
var d = date_issued.setDate(date_issued.getDate() + 14);
};

return d




Cheers
Harry

Oh wow! thanks! this works perfect! really appreciate your help! you guys are the best.