timeDifference()

This function subtracts two timestamps using a JWT calendar. The time time difference will be returned in milliseconds.


Bash
timeDifference(firstDate, dateToSubtract, calendarName, timeZone) #Output: Number


Examples

Assumption: A custom JWT calendar called "my_calendar" has been defined as follows:

MON - THU {
   08:00 - 15:00,
   16:00 - 19:30;
}
 
FRI {
    08:00 - 15:00;
}

Parser expression

Description

Bash
timeDifference({system.currentDateTime}, {issue.created}, "my-calendar", LOCAL)

This example calculates the elapsed time from issue creation to the current date and time using the calendar my-calendar.

The result will return milliseconds.

Bash
timeDifference({system.currentDateTime}, {issue.created}, "my-calendar", LOCAL) / {HOUR}

This example calculates the elapsed time from issue creation to the current date and time using the calendar my-calendar.

The result will return hours.


Additional information

Parameters used in this function

Parameter

Input (data type)

Description

firstDate

number

The parameter must be valid timestamp. Usually this value is retrieved from a

field

(e.g. due date, created date).

dateToSubtract

number

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

calendarName

text

The name of the used 

JWT calendar

.

timeZone

timezone

The time zone used for the conversion. 

Output

The function returns a number  .


Variant of the function where you can define an additional JWT calendar specification.


Bash
timeDifference(firstDate, dateToSubtract, calendarName, additionalSpecifier, timeZone) #Output: Number


Examples

Parser expression

Description

Bash
timeDifference({system.currentDateTime}, {issue.created}, "my-calendar", "2020/05/20 {;}", LOCAL)

This example calculates the elapsed time from issue creation to the current date and time using the calendar my-calendar and additionally ignoring the 20th of May, 2020.

The result will return milliseconds.

Bash
timeDifference({system.currentDateTime}, {issue.created}, "my-calendar", "2020/05/20 {;}", LOCAL) / {HOUR}

This example calculates the elapsed time from issue creation to the current date and time using the calendar my-calendar and additionally ignoring the 20th of May, 2020.

The result will return hours.


Additional information

Parameters used in this function

Parameter

Input (data type)

Description

firstDate

number

The parameter must be valid timestamp. Usually this value is retrieved from a

field

(e.g. due date, created date).

dateToSubtract

number

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

calendarName

text

The name of the used 

JWT calendar

.

additionalSpecifier

text

A text containing an additional 

JWT calendar specification

timeZone

timezone

The time zone used for the calculation. 

Output

The function returns a number


📚 Use cases and examples