Versions Compared

Key

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


Page properties
hiddentrue



Status
Tech review

Status
titletodo

Style guide

Status
titletodo

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged



Page properties
hiddentrue


Short description

Returns a 

Status
subtletrue
titlenumber
representing a timestamp equivalent "minuend_date - subtrahend_date" subtracting weekend periods from the resultSubtracts two timestamps ignoring the weekends.

Output

Status
subtletrue
titlenumber




UI Text Box
sizemedium
typeinfo

This functions subtracts two timestamps (the second date will be substracted from the first date) ignoring the weekends.

This way you can easily calculate the elapsed working time since weekends will be ignoredReturns a 

Status
subtletrue
titlenumber
representing a timestamp equivalent "minuend_date - subtrahend_date" subtracting weekend periods from the result. i.e., you get the elapsed working time from subtrahend_date to minuend_date.


Code Block
languagebash
titleSyntax
linenumberstrue
subtractDatesSkippingWeekends(number minuend_datefirstDate, number subtrahend_datedateToSubstract, timeZone time_zone) #Output: Number


UI Expand
titleExamples


Parser expressionDescription


Code Block
linenumberstrue
subtractDatesSkippingWeekends({issue.resolutionDate}, {issue.created}, LOCAL)


This example calculates the elapsed working time from issue creation to resolution

The result will return milliseconds.


Code Block
linenumberstrue
round(subtractDatesSkippingWeekends({issue.resolutionDate}, {issue.created}, LOCAL)/{HOUR})





UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
<parameter>firstDate

Status
subtletrue
titledata type

Parameter description.

number

The parameter must be valid timestamp. Usually this value is retrieved from a field (e.g. due date, created date).
dateToSubstract<parameter>

Status
subtletrue
titledata typenumber

The parameter must be valid timestamp. Usually this value is retrieved from a field (e.g. due date, created date)Parameter description.

timeZone

Status
subtletrue
titletimezone

The time zone used for the calculationconversion



true

ui-expand
titleOutput

The function returns a

Status
subtletrue
titlenumber
 representing a timestamp.

Learn more about timezones
Excerpt Include
Dates, times and time zonesDates, times and time zonesnopanel


UI Text Box
typetip

Work days might depend on the time zone - it might be Sunday on the west coast of the US while at the same time it's already Monday in Australia. 




ui-expand
titleOutput

The function returns a

Status
subtletrue
titlenumber

ui-text-box
sizemedium
typeinfo

Similar to Variantof the previous function, but with a custom defined weekend.Arguments beginning_of_weekend and end_of_weekend take values {MONDAY}, {TUESDAY} ... {SUNDAY} .function where you can additionally define the start and the end of the weekend.

This function is useful when the non-working days differ from the standard (Saturday/Sunday).


Code Block
languagebash
titleSyntax
linenumberstrue
subtractDatesSkippingWeekends(number minuend_datefirstDate, number subtrahend_datedateToSubtract, timeZone time_zone, number beginning_of_weekendstartOfWeekend, number end_of_weekendendOfWeekend) #Output: number


UI Expand
titleExamples


Parser expressionDescription


Code Block
languagebash
linenumberstrue
subtractDatesSkippingWeekends({00112issue.resolutionDate}, {00009issue.created}, LOCAL, {FRIDAY}, {SATURDAY})

Calculating the worktime from Creating to Resolution using Israeli weekend.

UI Text Box
typenote

{00112} is field code for Resolution date and time

{00009} is field code for Creation date and time.


This example calculates the elapsed working time from issue creation to resolution using an Arabic weekend.

The result will return milliseconds.


Code Block
languagebash
linenumberstrue
round(subtractDatesSkippingWeekends({issue.resolutionDate}, {issue.created}, LOCAL, {FRIDAY}, {SATURDAY})/{DAY})


This example returns the full days instead of milliseconds.

To achieve this the {DAY} time macro and the round()function.

Additional useful functions can be found here: Numbers and mathematical functions



<parameter>
UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
<parameter>firstDate

Status
subtletrue
titledata type

Parameter description.

number

The parameter must be valid timestamp. Usually this value is retrieved from a field (e.g. due date, created date).
dateToSubtract<parameter>

Status
subtletrue
titledata typenumber

The parameter must be valid timestamp. Usually this value is retrieved from a field (e.g. due date, created date)Parameter description.

timeZone

Status
subtletrue
titletimezone

The time zone used for the calculationconversion

startOfWeekend

Status

expand

titleLearn more about timezones
Excerpt Include
Dates, times and time zonesDates, times and time zones
nopaneltrue
subtletrue
titlenumber

The parameter will take values in the format of {MONDAY},{TUESDAY}...{SUNDAY}
endOfWeekend<parameter>

Status
subtletrue
title

data typeParameter description.

number

The parameter will take values in the format of {MONDAY},{TUESDAY}...{SUNDAY}



Parameter description

UI Expand
titleOutput

The function returns a

Status
subtletrue
title

data type
number
 representing a timestamp.


number

UI Text Box
typetip

Work days might depend on the time zone - it might be Sunday on the west coast of the US while at the same time it's already Monday in Australia. 

UI Expand
titleOutput

The output can be written into any number field.

Another very common use case is to use this function in a JWT calculated date-time fields. If you don't want to work with milliseconds check out all available time macros.

If you want to simply add days to a timestamp you might want to have a look at the function addDaysSkippingWeekends().

Not sure what this function returns?  Simply test your expression on the expression parser test page.The function returns a

Status
subtletrue
title