Numeric values of Number, Date, Date-Time and Priority data type fields can be inserted in expressions with following notation {...somefield}, e.g., use Pro tip NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER Fields of type Date and Date-Time contain a numeric value with the milliseconds elapsed since January 1, 1970, 00:00:00 GMT. We usually need to get significative numbers from this numeric value, like YEAR, MONTH, DAY, HOUR, MINUTE, etc. To achieve this, Automation Toolbox for Jira provides a comprehensive set of functions, most of them with TIMEZONE as input argument, since any significative number relative to a timestamp depends on the timezone. timePart(number t, timeZone time_zone) TIMEZONE Returns the time part of timestamp represented by numeric value t in time_zone time zone. TIMEZONE Returns the date part of timestamp represented by numeric value t in time_zone time zone. TIMEZONE Returns the seconds figure of timestamp represented by numeric value t in time_zone time zone. TIMEZONE Returns the minutes figure of timestamp represented by numeric value t in time_zone time zone. TIMEZONE Returns the hours figure of timestamp represented by numeric value t in time_zone time zone. NUMBER Returns the day of the week of timestamp represented by numeric value t in time_zone time zone, with Sunday = 1, Monday = 2, ... Saturday = 7. NUMBER Returns the day of the month of timestamp represented by numeric value t in time_zone time zone. NUMBER Returns the month of a timestamp represented by numeric value t in a certain time zone, with January = 1, February = 2, ... December = 12. NUMBER Returns the year of a timestamp represented by numeric value t in a certain time zone. NUMBER Returns a timestamp as a NUMBER resultant of adding n days to timestamp t. You should use this function instead of simply adding NUMBER Returns a timestamp resultant of adding n months to timestamp t. You should use this function instead of simply adding NUMBER Returns a timestamp resultant of adding n years to timestamp t. You should use this function instead of simply adding NUMBER Adds timeToBeAdded to t and returns a NUMBER with the difference that weekends don't count in the sum, e.g., if t represents a date-time which coincides with a Saturday, adding timeToBeAdded = 2 * {HOUR} will return a date-time for next Monday at 02:00 . Use negative values at timeToBeAdded for subtracting time from t. NUMBER Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values NUMBER Returns a timestamp as a NUMBER equivalent of NUMBER Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values NUMBER Returns a timestamp as a NUMBER 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. NUMBER Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values NUMBER Returns a STRING representing the date-time value at t, in a certain time zone, and in a certain language. This function is useful in the Action Update Field to represent as a string the result of a time expression. NUMBER Returns a STRING representing the date-time value at t, in a certain time zone, and in a certain language. This function is useful in the Action Update Field to represent as a string the result of a time expression. NUMBER Returns a STRING representing the date-time value at t with a certain custom format defined by date_time_pattern string parameter, using a certain language when using words for months, days of the week, etc. This function is useful in Action Update Field to represent as a string the result of a time expression. NUMBER Returns a STRING representing the date-time value at t with a certain custom format defined by date_time_pattern string parameter, in a certain timezone time_zone, using a certain language when using words for months, days of the week, etc. This function is useful in the Action Update Field to represent as a string the result of a time expression. Example: Example: NUMBER Returns a STRING with the name of the month for a date-time t, in a certain time zone time_zone, and in a certain language. This function can be used in the Action Update Field to write the name of the month of a date-time field or expression. NUMBER Returns a STRING with the day of the week for a date-time t, in a certain time zone time_zone, and in a certain language. This function is useful in the Action Update Field to write the day of the week of a date-time field or expression. TIMEZONE STRING Returns a NUMBER with the date-time represented by string s. The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT. Valid input string formats are yyyy/MM/dd HH:mm, yyyy-MM-dd HH:mm, yyyy/MM/dd, yyyy-MM-dd, also formats relative to current time like in JQL queries: "w" (weeks), "d" (days), "h" (hours) or "m" (minutes), or format defined at system property jira.date.time.picker.java.format. STRING Returns a NUMBER with the date-time represented by string s. Expected format of value at parameter "s" is defined by date_time_pattern string parameter. The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT. Example: STRING Returns a NUMBER with the date-time represented by string s. Expected format of value at parameter "s" is defined by date_time_pattern string parameter for a specific language (language code ISO 639-2 ) and country (country code ISO 3166 alpha-2 ). The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT. Example: DURATION Returns a STRING with the pretty representation of a time duration, i.e. a subtraction of 2 date-time values, using the language of current user's profile. Example: DURATION Returns a STRING with the most compact representation possible of a time duration, i.e. a subtraction of 2 date-time values, using the language of current user's profile. Example: DURATION Returns a STRING similar to function Example: DURATION Returns a STRING similar to function Example: TIMEZONE Returns the timeZone whose name is represented by string timeZone_name. This function is useful to obtain a timeZone from a string, like the value of a Project Properties. Example: Date-Time values are numeric values representing the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT. Macros are aliases for literal / fixed values. A comprehensive set of time macros is provided to make your expressions more readable.Fixed values
Input Format Example Valid numerical values 1
3.0
.5
-400
-1.1
-.02
Valid Date-time values yyyy/MM/dd [hh:mm]or yyyy-MM-dd [hh:mm] 2018/03/25 23:15
2018-03-25 23:15
2018/03/25
2018-03-25
Valid Time values hh:mm 08:15
23:59
00:00
Variable values (field values)
{...duedate}
for Due Date, and {...numberOfAttachments}
for Number of attachments. {...somefield} = null
or {...somefield} != null
Math Functions
Function Input Returned value abs(number x) Returns the absolute value of x, i.e., if x>0 it returns x, otherwise it returns -x. acos(number x) Returns the arc cosine of x; the returned angle is in the range 0.0 through pi. asin(number x) Returns the arc sine of x; the returned angle is in the range 0.0 through pi. atan(number x) Returns the arc tangent of x; the returned angle is in the range 0.0 through pi. ceil(number x) Returns the smallest (closest to negative infinity) value that is larger than or equal to x and is equal to a mathematical integer. cbrt(number x) Returns the cube root of x. cos(number x) Returns the trigonometric cosine of angle x expressed in radians. cosh(number x) Returns the hyperbolic cosine of x. floor(number x) Returns the largest (closest to positive infinity) value that is less than or equal to x and is equal to a mathematical integer. log(number x) Returns the natural logarithm (base e) of x. log10(number x) Returns the base 10 logarithm of x. max(number x, number y) Returns the larger of two numeric values. min(number x, number y) Returns the smaller of two numeric values. modulus(number dividend, number divisor) Returns dividend - (divisor * floor(dividend / divisor))
. pow(number x, number y) Returns x raised to the power y. random() Returns a value with a positive sign, greater than or equal to 0.0 and less than 1.0. remainder(number dividend, number divisor) Returns dividend - divisor * n
, where n is the closest integer to dividend / divisor
. round(number x) Returns the closest integer to x. sin(number x) Returns the trigonometric sine of angle x expressed in radians. sinh(number x) Returns the hyperbolic sine of x. sqrt(number x) Returns the square root of x. tan(number x) Returns the trigonometric tangent of angle x expressed in radians. tanh(number x) Returns the hyperbolic tangent of x. toDegrees(number x) Converts an angle x measured in radians to an approximately equivalent angle measured in degrees. toRadians(number x) Converts an angle x measured in degrees to an approximately equivalent angle measured in radians. Date-Time Functions
Function Input Returned value
Example: for timestamp March, 25th 2011 23:15 this function returns a NUMBER representing time 23:15 in milliseconds datePart(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15 this function returns a NUMBER representing date March, 25th 2011 00:00 in milliseconds second(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15:30 this function returns a NUMBER representing 30 seconds in milliseconds. minute(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15:30 this function returns a NUMBER representing 15 minutes in milliseconds. hour(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15:30 this function returns a NUMBER representing 23 hours in milliseconds. dayOfTheWeek(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15 this function returns 6 for Friday as a NUMBER, represented also by macro {FRIDAY}
. dayOfTheMonth(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15 this function returns 25 as a NUMBER. month(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15 this function returns 3 for March as a NUMBER, represented also by macro {MARCH}
. year(number t, timeZone time_zone)
Example: for timestamp March, 25th 2011 23:15 this function returns 2011 as a NUMBER . addDays ( number t, number n, timeZone time_zone ) n * {DAY}
, since {DAY}
is a macro equivalent to 24 * {HOUR}
, not taking into account that once in a year we have a day with 25 or 23 hours due to DST transition. Negative values for n are used in order to subtract instead of adding.
Example: addDays(2018/03/27 01:00, -2, LOCAL)
returns 2018/03/25 01:00 . addMonths(number t, number n, timeZone time_zone) n * {MONTH}
, since {MONTH}
is a macro equivalent to 30 * {DAY}
, not taking into account that some months has more or less than 30 days. Negative values for n are used in order to subtract instead of adding.
Example: for timestamp t with value March, 25th 2011 23:15 calling to addMonths(t, 3, LOCAL)
will return a timestamp as a NUMBER with value June, 25th 2011 23:15 addYears(number t, number n, timeZone time_zone) 12 * {MONTH}
or 365 * {DAY}
, since that won't take into account that some years have 366 days. Negative values for n are used in order to subtract instead of adding.
Example: for timestamp t with value March, 25th 2011 23:15 calling to addYears(t, 10, LOCAL)
will return a timestamp as a NUMBER with value March, 25th 2021 23:15 addTimeSkippingWeekends(number t, number timeToBeAdded, timeZone time_zone) addTimeSkippingWeekends(number t, number timeToBeAdded, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) {MONDAY}
, {TUESDAY} ... {SUNDAY}
.
Example of usage for adding 12 hours to Current date and time using Israeli weekend: addTimeSkippingWeekends({...currentDateTime}, 12 * {HOUR}, LOCAL, {FRIDAY}, {SATURDAY})
addDaysSkippingWeekends(number t, number n, timeZone time_zone) t + n*{DAY}
with the difference that weekends don't count in the sum, e.g., if t represents a timestamp which coincides with a Friday, adding n = 1 will return a date-time for next Monday. Negative values for n are used in order to subtract days to t. addDaysSkippingWeekends(number t, number n, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) {MONDAY}, {TUESDAY} ... {SUNDAY}
.
Example of usage for adding 10 workdays to Due date using Israeli weekend: addDaysSkippingWeekends({...duedate}, 10, LOCAL, {FRIDAY}, {SATURDAY})
subtractDatesSkippingWeekends(number minuend_date, number subtrahend_date, timeZone time_zone) subtractDatesSkippingWeekends(number minuend_date, number subtrahend_date, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) {MONDAY}, {TUESDAY} ... {SUNDAY}
.
Example of usage calculating the worktime from Creation to Resolution using Israeli weekend: subtractDatesSkippingWeekends({...resolutiondate}, {...created}, LOCAL, {FRIDAY}, {SATURDAY})
dateToString(number t, timeZone time_zone, language) dateTimeToString(number t, timeZone time_zone, language) dateTimeToString(number t, string date_time_pattern , language)
Example: dateTimeToString(2011-03-25 11:30, "yyyy.MM.dd 'at' HH:mm:ss", USER_LANG)
returns string "2011.03.25 at 11:30:00". dateTimeToString(number t, string date_time_pattern , timeZone time_zone, language) dateTimeToString(0, "yyyy.MM.dd 'at' HH:mm:ss", GMT, USER_LANG)
returns string "1970.01.01 at 00:00:00".dateTimeToString(0, "yyyy.MM.dd 'at' HH:mm:ss", MST, USER_LANG)
returns string "1969.12.31 at 17:00:00". monthToString(number t, timeZone time_zone, language) dayOfTheWeekToString(number t, timeZone time_zone, language) stringToDate(string s, timeZone time_zone) stringToDate(string s, string date_time_pattern ) stringToDate("2011.03.25 at 11:30:00", "yyyy.MM.dd 'at' HH:mm:ss")
returns a date-time numeric value that can be used for setting a Date Time picker custom field. stringToDate(string s, string date_time_pattern , string language , string country ) stringToDate("Dec 7, 2016 2:10:25 AM PST", "MMM d, yyyy h:mm:ss a z", "eng", "US")
returns a date-time numeric value that can be used for setting a Date Time picker custom field. formatDuration(number duration) formatDuration(2017-01-31 11:30 - 2017-01-30 00:00)
returns "1 day, 11 hours, 30 minutes" . shortFormatDuration(number duration) shortFormatDuration(2017-01-31 11:30 - 2017-01-30 00:00)
returns "1d 11h 30m" . formatWorkDuration(number duration) formatDuration()
but using the workday and workweek defined at time tracking configuration , instead of 24 hours per day and 7 days per week.formatWorkDuration(5 * 8 * {HOUR} + 2 * 8 * {HOUR} + 3 * {HOUR})
returns "1 week, 2 days, 3 hours", with 8 hours per workday and 5 days per workweek. shortFormatWorkDuration(number duration) shortFormatDuration()
but using the workday and workweek defined at time tracking configuration , instead of 24 hours per day and 7 days per week.formatWorkDuration(5 * 8 * {HOUR} + 2 * 8 * {HOUR} + 3 * {HOUR})
returns "1w 2d 3h" , with 8 hours per workday and 5 days per workweek. timeZone(string timeZone_name) timeZone("DST")
returns DST timeZone.Time Macros
Macro Equivalent value {SECOND}
1000
{MINUTE}
1000 * 60
{HOUR}
1000 * 60 * 60
{DAY}
1000 * 60 * 60 * 24
{WEEK}
1000 * 60 * 60 * 24 * 7
{MONTH}
1000 * 60 * 60 * 24 * 30
{YEAR}
1000 * 60 * 60 * 24 * 365
The following macros are available to be used with function dayOfTheWeek(t, time_zone)
:Macro Equivalent value {SUNDAY}
1
{MONDAY}
2
{TUESDAY}
3
{WEDNESDAY}
4
{THURSDAY}
5
{FRIDAY}
6
{SATURDAY}
7
The following macros are available to be used with function month(t, time_zone)
:Macro Equivalent value {JANUARY}
1
{FEBRUARY}
2
{MARCH}
3
{APRIL}
4
{MAY}
5
{JUNE}
6
{JULY}
7
{AUGUST}
8
{SEPTEMBER}
9
{OCTOBER}
10
{NOVEMBER}
11
{DECEMBER}
12
Examples
Input Output (2 * 6) / 3
Returns the result of a simple calculation: 4 {...duedate} + 2 * {DAY}
Returns a date which is two days in the future of the current Due Date. round(({...duedate} - {...currentDateTime}) / {HOUR})
Returns the number of hours from between the current date and time to Due Date.
🚀 Effective since April 2020 and JWT version 2.9.0 Automation Toolbox for Jira is fully integrated into our top rated app Jira Workflow Toolbox (JWT). 🚀