The CreatorCon Call for Content is officially open! Get started here.

How to calculate number of minutes of a month

veronica_malmo
Kilo Expert

Hi,

I would like an indicator that shows how many business minutes there is in a month. I have a schedule and by using that I want it to calculate the minutes so I can show it in an indicator. 

I have one indicator that calculates the minutes an incident has been open (business hours) but I need another indicator to divide it by the total business minutes in the month. Can I do this directly in an indicator, or do I need to create a table to hold the data?

6 REPLIES 6

dvp
Mega Sage

You can use duration calculator

 

Here is an example script

var dc = new DurationCalculator();
dc.setSchedule('08fcd0830a0a0b2600079f56b1adb9ae'); // Schedule sys_id. Naavigate to System Scheduler > Schedules
var dur = dc.calcScheduleDuration(start, end); // Update start and end variables

var business_days = dur/(60*60*9); // If you are using 8AM - 5PM schedule use 9

Not sure I can use that one. On what table should I use it? If I point it to the schedule table there is not really a start and end field..