Dates, times and time zones

All date-time values are numeric values representing the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.

JWT offers various ways of displaying or calculating date-time values, such as JWT calculated number fields.

General information

Time values can be manipulated and might depend on certain factors. These are listed below. 

Time Macros

While the number of milliseconds might be useful in some cases, usually you want to retrieve values that are more readable (e.g. when being used in calculated fields).

Macros are aliases for fixed values. They are often used to convert milliseconds to a more accessible value.

List of all 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 

timeLogged(subtasks())

This example returns the sum of all time logged on all subtasks of the current issue in milliseconds (see timeLogged() for more examples).

If you want to display the value and maybe compare it wit an original estimate you might need the number of hours instead. Simply divide the results by the {HOUR} time macro and you get the number of hours instead.

timeLogged(subtasks())/{HOUR}


The following macros return the day of the week:

Macro

Equivalent value

{SUNDAY}

1

{MONDAY}

2

{TUESDAY}

3

{WEDNESDAY}

4

{THURSDAY}

5

{FRIDAY}

6

{SATURDAY}

7

Use these macros in the following functions:

dayOfTheWeek()

dayOfTheWeekToString()

dayOfTheMonth()

dayOfTheYear()



The following macros return the month:

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

Use these macros in the following functions:

month()

monthToString()

Time zones

Fields of type date and date-time contain a numeric value with the milliseconds elapsed since January 1, 1970, 00:00:00 GMT.

The number that will be returned by any function using a date or date-time timestamp depends on a time zone.

Available time zones

Time zone macro

Output

LOCAL or SERVER_LOCAL

Returns the time zone configured for the server running Jira.

USER_LOCAL

Returns the time zone of the current user.

RUN_AS_LOCAL

Returns the time zone of the selected Run as user.

Languages

When dealing with times and time zones sometimes you need to convert them to text. The text returned depends on the selected language.

Available languages

Language macro

Output

SERVER_LANG

Returns the default language configured for the server running Jira.

USER_LANG

Returns the language of the current user.

RUN_AS_LANG

Returns the language of the selected Run as user.

Available functions

Function Short description Output
lastDayOfTheMonth()

Returns the last day of the month of a given timestamp.

number

dayOfTheWeek()

Returns the day of the week of any given timestamp.

number

dateToString()

Returns the timestamp of a date part of any given date in text form

text

nextTime()

Returns the next possible timestamp based on a JWT calendar specification.

number

dayOfTheWeekToString()

Returns the day of the week of any given timestamp in text form.

text

timeInStatus()

Returns the time the current issue has remained in a specific status.

number

timePart()

Returns the time part of any given date.

number

formatDuration()

Returns a duration in text form.

text

hour()

Returns the hour part of any given timestamp.

number

shortFormatWorkDuration()

Returns a calculated duration using the workday and workweek defined at time tracking configuration in a comprehensive form.

text

dateTime()

Creates a timestamp based on input values.

number

shortFormatDuration()

Returns a duration in short text form.

text

formatWorkDuration()

Returns a calculated duration using the workday and workweek defined at time tracking configuration.

text

minute()

Returns the minutes part of a given timestamp.

number

addDays()

Adds or subtracts days to or from any given date.

number

fieldChangeTimes()

Returns the timestamps of when a field has changed satisfying a certain condition.

number list

subtractDatesSkippingWeekends()

Subtracts two timestamps ignoring the weekends.

number

timeZone()

Returns a time zone.

time zone

weekOfTheYear()

Returns the week of a year.

number

addTimeSkippingWeekends()

Adds or subtracts time to or from any given date.

number

dateTimeToString()

Returns the timestamp of any given date in text form

text

timeInValue()

Returns the time an issue field has had a specific value.

number

addYears()

Adds or subtracts years to or from any given date.

number

addMonths()

Adds or subtracts months to from any given date.

number

month()

Returns the month part of a given timestamp.

number

addDaysSkippingWeekends()

Adds or subtracts natural days (or working days) to or from any given date.

number

timeDifference()

Subtracts two timestamps based on a JWT calendar specification

number

year()

Returns the year part of a timestamp.

number

lastFieldChangeTime()

Returns the timestamp of the most recent value change of any given field.

number

monthToString()

Returns the name of the month for a given timestamp.

text

dayOfTheMonth()

Returns the day of the month of any given timestamp.

number

timeLogged()

Returns the sum of all the time logged on issues.

number

datePart()

Returns the date part of any given timestamp.

number

addTime()

Adds or subtracts days to or from any given timestamp based on a JWT calendar specification.

number

second()

Returns the second part of any given timestamp.

number

dayOfTheYear()

Returns the day of the year of any given timestamp.

number

nextDayOfTheWeek()

Returns a timestamp for the next occurence of any given day.

number

withinCalendar()

Checks whether a timestamp falls into a time frame defined in a JWT calendar specification.

boolean

stringToDate()

Converts a text into a date.

number

daysInTheMonth()

Returns the number of days in a month of any given timestamp.

number