This function adds or subtracts time to or from any given date.

Weekends will not be counted as working days.



addTimeSkippingWeekends(timestamp, timeToBeAdded, timeZone) #Output: Number



Parser expressionDescription


addTimeSkippingWeekends({issue.dueDate}, 1 * {MONTH} + 2 * {HOUR}, LOCAL)


This example adds 1 month and 2 hours to the issue's due date.

Weekends won't be taken into account.


addTimeSkippingWeekends({issue.created}, 3 * {DAY} + 1 * {HOUR}, LOCAL)


This example adds 3 days and 1 hour to the issue's creation date.

Weekends won't be taken into account.


addTimeSkippingWeekends({issue.dueDate}, - 1 * {YEAR}, LOCAL)


This example subtracts 1 year from the issue's due date.

Weekends won't be taken into account.



Parameters used in this function

ParameterInput (data type)Description
timestamp

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

The offset, supporting the usage of time macrosLearn more about time macros. Negative values are used to subtract time.

timeZone

The time zone used for the calculation. 


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. 



This function returns a  representing a timestamp.

The output can be written into any Jira field of type Date Picker or Date Time Picker.

Another very common use case is to use this function in a JWT calculated date-time field.

If you want to convert the number into a text, you might want to take a look at the dateTimeToString() function.





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


addTimeSkippingWeekends(timestamp, timeToBeAdded, timeZone, startOfWeekend, endOfWeekend) #Output: Number



Parser expressionDescription


addTimeSkippingWeekends({system.currentDateTime}, 12 * {HOUR}, LOCAL, {FRIDAY}, {SATURDAY})


This example adds 12 hours to the current date and time.

Fridays and Saturdays are not counted and will be skipped.


addTimeSkippingWeekends({system.currentDateTime}, -2 * {DAY}, LOCAL, {SUNDAY}, {TUESDAY})


This example subtracts 2 days from the current date and time.

Sundays, Mondays and Tuesdays are not counted and will be skipped.



Parameters used in this function

ParameterInput (data type)Description
timestamp

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

The offset, supporting the usage of time macrosLearn more about time macros.

Negative values are used to subtract time.

timeZone

The time zone used for the calculation. 

startOfWeekend

Valid values are {MONDAY}{TUESDAY} ... {SUNDAY}.
endOfWeekend

Valid values are {MONDAY}{TUESDAY} ... {SUNDAY}.


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. 



This function returns a  representing a timestamp

The output can be written into any Jira field of type Date Picker or Date Time Picker.

Another very common use case is to use this function in a JWT calculated date-time field.

If you want to convert the number into a text, you might want to take a look at the dateTimeToString() function.




Use cases and examples




Status
Tech review

Style guide




Short description

Adds or subtracts time to or from any given date.

Output

Available since

Label