We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to calculate the difference between two dates (current date and start date) in business days?

pvn
Tera Contributor

Hi All,

 

I need to calculate difference between start date of an employee and today's date in business days using a schedule defined. What is the simplest way to achieve this?

 

Thanks in advance.

5 REPLIES 5

Not applicable
var startdate = new GlideDateTime(current.getValue('start_date'));
var end date = new GlideDateTime();
var dur = new GlideDuration();
dur =gs.dateDiff (startdate, end date); //the difference between 
gs.addInfoMessage("Date Difference"+dur);

Please Mark Helpful 
Thanks 
Mayuri