Versions Compared

Key

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


Page properties
hiddentrue



Status
Tech review

Status
colourGreen
titledone

Style guide

Status
colourGreen
titledone

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


Page properties
hiddentrue


Short description

Subtracts two timestamps ignoring the weekends.

Output

Status
subtletrue
titlenumber

Available since

Status
subtletrue
colourBlue
title2.2.7



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 ignored.


Code Block
languagebash
titleSyntax
linenumberstrue
subtractDatesSkippingWeekends(firstDate, dateToSubstract, timeZone) #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})


This example returns the hours instead of milliseconds.

Additional useful functions can be found here: Numbers



UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
firstDate

Status
subtletrue
titlenumber

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

Status
subtletrue
titlenumber

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

timeZone

Status
subtletrue
titletimezone

The time zone used for the conversion. 



UI Expand
titleOutput

This function returns a

Status
subtletrue
titlenumber
 representing a timestamp.


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 Text Box
sizemedium
typeinfo

Variant of the 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(firstDate, dateToSubtract, timeZone, startOfWeekend, endOfWeekend) #Output: number


UI Expand
titleExamples


Parser expressionDescription


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


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 are used.

Additional useful functions can be found here: Numbers



UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
firstDate

Status
subtletrue
titlenumber

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

Status
subtletrue
titlenumber

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

timeZone

Status
subtletrue
titletimezone

The time zone used for the conversion. 

startOfWeekend

Status
subtletrue
titlenumber

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

Status
subtletrue
titlenumber

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



UI Expand
titleOutput

This function returns a

Status
subtletrue
titlenumber
 representing a timestamp.


UI Text Box
typetip

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.