Fixed values
- Examples of valid numerical input values:
1
,3.0
,4.2
,.5
,-400
,-1.1
,-11.5
,-.02
- Examples of valid Date-time values / formats: yyyy/MM/dd [hh:mm] or yyyy-MM-dd [hh:mm] , e.g.,
2018/03/25 23:15
,2018-03-25 23:15
,2018/03/25
and2018-03-25
- Examples of valid Time values / formats: hh:mm , e.g.,
08:15
,23:59
,00:00
Variable values (field values)
Numeric values of Number, Date, Date-Time and Priority data type fields can be inserted in expressions with following notation {...somefield}, e.g., use {...duedate}
for Due Date, and {...numberOfAttachments}
for Number of attachments.
Pro tip
Math Functions
Function | Input | Returned value |
---|---|---|
abs(number x) | NUMBER | Returns the absolute value of x, i.e., if x>0 it returns x, otherwise it returns -x. |
acos(number x) | NUMBER | Returns the arc cosine of x; the returned angle is in the range 0.0 through pi. |
asin(number x) | NUMBER | Returns the arc sine of x; the returned angle is in the range 0.0 through pi. |
atan(number x) | NUMBER | Returns the arc tangent of x; the returned angle is in the range 0.0 through pi. |
ceil(number x) | NUMBER | 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) | NUMBER | Returns the cube root of x. |
cos(number x) | NUMBER | Returns the trigonometric cosine of angle x expressed in radians. |
cosh(number x) | NUMBER | Returns the hyperbolic cosine of x. |
floor(number x) | NUMBER | 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) | NUMBER | Returns the natural logarithm (base e) of x. |
log10(number x) | NUMBER | Returns the base 10 logarithm of x. |
max(number x, number y) | NUMBER | Returns the larger of two numeric values. |
min(number x, number y) | NUMBER | Returns the smaller of two numeric values. |
modulus(number dividend, number divisor) | NUMBER | Returns dividend - (divisor * floor(dividend / divisor)) . |
pow(number x, number y) | NUMBER | Returns x raised to the power y. |
random() | NUMBER | Returns a value with a positive sign, greater than or equal to 0.0 and less than 1.0. |
remainder(number dividend, number divisor) | NUMBER | Returns dividend - divisor * n , where n is the closest integer to dividend / divisor . |
round(number x) | NUMBER | Returns the closest integer to x. |
sin(number x) | NUMBER | Returns the trigonometric sine of angle x expressed in radians. |
sinh(number x) | NUMBER | Returns the hyperbolic sine of x. |
sqrt(number x) | NUMBER | Returns the square root of x. |
tan(number x) | NUMBER | Returns the trigonometric tangent of angle x expressed in radians. |
tanh(number x) | NUMBER | Returns the hyperbolic tangent of x. |
toDegrees(number x) | NUMBER | Converts an angle x measured in radians to an approximately equivalent angle measured in degrees. |
toRadians(number x) | NUMBER | Converts an angle x measured in degrees to an approximately equivalent angle measured in radians. |
Date-Time Functions
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.
Function | Input | Returned value |
---|---|---|
timePart(number t, timeZone time_zone) | TIMEZONE | Returns the time part of timestamp represented by numeric value t in time_zone time zone. |
datePart(number t, timeZone time_zone) | TIMEZONE | Returns the date part of timestamp represented by numeric value t in time_zone time zone. |
second(number t, timeZone time_zone) | TIMEZONE | Returns the seconds figure of timestamp represented by numeric value t in time_zone time zone. |
minute(number t, timeZone time_zone) | TIMEZONE | Returns the minutes figure of timestamp represented by numeric value t in time_zone time zone. |
hour(number t, timeZone time_zone) | TIMEZONE | Returns the hours figure of timestamp represented by numeric value t in time_zone time zone. |
dayOfTheWeek(number t, timeZone time_zone) : number | NUMBER TIMEZONE | 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. |
dayOfTheMonth(number t, timeZone time_zone) | NUMBER | Returns the day of the month of timestamp represented by numeric value t in time_zone time zone. |
month(number t, timeZone 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. |
year(number t, timeZone time_zone) | NUMBER | Returns the year of a timestamp represented by numeric value t in a certain time zone. |
addDays ( number t, number n, timeZone 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 |
addMonths(number t, number n, timeZone time_zone) | NUMBER | Returns a timestamp resultant of adding n months to timestamp t. You should use this function instead of simply adding |
addYears(number t, number n, timeZone time_zone) | NUMBER | Returns a timestamp resultant of adding n years to timestamp t. You should use this function instead of simply adding |
addTimeSkippingWeekends(number t, number timeToBeAdded, timeZone time_zone) | 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 = |
addTimeSkippingWeekends(number t, number timeToBeAdded, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) | NUMBER | Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values |
addDaysSkippingWeekends(number t, number n, timeZone time_zone) | NUMBER | Returns a timestamp as a NUMBER equivalent of |
addDaysSkippingWeekends(number t, number n, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) | NUMBER | Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values |
subtractDatesSkippingWeekends(number minuend_date, number subtrahend_date, timeZone time_zone) | 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. |
subtractDatesSkippingWeekends(number minuend_date, number subtrahend_date, timeZone time_zone, number beginning_of_weekend, number end_of_weekend) | NUMBER | Same as previous function, returns a NUMBER but with a custom defined weekend. Arguments beginning_of_weekend and end_of_weekend take values |
dateToString(number t, timeZone time_zone, language) | 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. |
dateTimeToString(number t, timeZone time_zone, language) | 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. |
dateTimeToString(number t, string date_time_pattern , language) | 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 Actio n Update Field to represent as a string the result of a time expression. |
dateTimeToString(number t, string date_time_pattern , timeZone time_zone, language) | 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: |
monthToString(number t, timeZone time_zone, language) | NUMBER | Returns a STRING with the name of the month for a date-time t, in a certain 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. |
dayOfTheWeekToString(number t, timeZone time_zone, language) | NUMBER | Returns a STRING with the day of the week for a date-time t, in a certain 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. |
stringToDate(string s, timeZone time_zone) | 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. |
stringToDate(string s, string date_time_pattern ) | 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: |
stringToDate(string s, string date_time_pattern , string language , string country ) | 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: |
formatDuration(number duration) | 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: |
shortFormatDuration(number duration) | 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: |
formatWorkDuration(number duration) | DURATION | Returns a STRING similar to function Example: |
shortFormatWorkDuration(number duration) | DURATION | Returns a STRING similar to function shortFormatDuration() but using the workday and workweek defined at time tracking configuration , instead of 24 hours per day and 7 days per week. Example: |
timeZone(string timeZone_name) | 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: |
Time Macros
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.
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 |