Is it possible to calculate difference between 2 date/time fields using a formula indicator that getting date returned as days, the results to be showed in reports using PA

Azim Mohamed
Kilo Contributor

Is it possible to calculate difference between 2 date/time fields using a formula indicator that getting date returned as days, the results to be showed in reports using PA?

4 REPLIES 4

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

I think we need to script that in PA indicators but need to check on this.


Thanks,
Ashutosh

gullet66
ServiceNow Employee
ServiceNow Employee

Hi, this is a script in an indicator that will calculate the difference between change close times in days: 

var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, current.closed_at);

Documentation

Hi,

 

After submitting the code. what should be followed in order to get the values?

 

Thanks

When using a fields from a database view how should script should approached?

For example Task_sla includes the business_duration column

 

And once the submit the code what should be followed in order to get the generated values?