Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Below are some examples of how we can convert intervals into days and hours. Because of the Type Conversion feature of SIL, both numbers and intervals can be used in an equation to calculate days, hours and minutes. The trunc() routine returns only whole numbers.

Code Block
number durationMillis = due - created;
interval durationInterval = due - created;
number days = trunc(durationMillis / (1000 * 60 * 60 * 24), 0);
number hours = trunc(durationInterval / (1000 * 60 * 60), 0);
number minutes = trunc(durationInterval / (1000 * 60), 0);
 
runnerLog(durationMillis);
runnerLog(durationInterval);
runnerLog(days);
runnerLog(hours);
runnerLog(minutes);

Accounting for 8 Hour Days

For certain durations, Jira considers one day equal to 8 hours. By following the logic found our example equation from the "Background" section, we would divide by 8 as demonstrated below:

Code Block
days = millis / (1000 millis * 60 seconds * 60 minutes * 8 hours)

At other times you may find it necessary to divide by 3 (because 24 hours divided by 8 is 3).

Code Block
interval example = "2w 4d 4h";
number hours = trunc(example / (1000 * 60 * 60), 0);
number jiraHours = hours/3;
runnerLog(jiraHours);

Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.

...

Filter by label (Content by label)
page
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@135a7
showSpacefalse
sortmodified
showSpacetypefalsepage
reversetruetype
labelskb-how-to-article
cqllabel = "kb-how-to-article" and type = "page" and space = "PKB"labelskb-how-to-article
Page Properties
hiddentrue

Related issues