getting number of working days between start date and end date

chidanandadhath
Kilo Guru

I want to get number of working days between start date and end date in a business rule.

1 ACCEPTED SOLUTION

add +1 to business_days. That should solve the issue

 

Use the below logic to add 1

var dc = new DurationCalculator();
		dc.setSchedule('eb65c2250fc76340e1f30dbce1050ee2', 'Los Angeles'); // Schedule sys_id and system time zone
		var dur = dc.calcScheduleDuration(start, end);
		
		var business_days = dur/(60*60*9); // Update the t
var gdt = new GlideDateTime(end);
var day_of_month = gdt.getDayOfWeekUTC();

if(day_of_month < 6)
business_days += 1;

View solution in original post

20 REPLIES 20

JPSS
Tera Contributor

@dvp 

 

Could you please help with below query 

 

Re: How to subtract days from a schedule - ServiceNow Community