Dates and times

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

JWT for Jira Cloud offers various ways of displaying or calculating with date-time values.

General information

Time values can be manipulated and might depend on certain factors. See the lists below. 

Time Constants

While the number of milliseconds might be useful in some cases, usually you want to retrieve values that are more readable.

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

Constant

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 constants return the day of the week:

Constant

Equivalent value

SUNDAY

1

MONDAY

2

TUESDAY

3

WEDNESDAY

4

THURSDAY

5

FRIDAY

6

SATURDAY

7

Use these constants for instance with the following functions:

dayOfTheWeek()

dayOfTheMonth()

The following constants return the month:

Constant

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 constants for instance with the following functions:

dayOfTheMonth()

Date and Time Literals

Explicit time and date values can also be used as constants. Time literals have the form HH:MM, e.g. 09:15 or 23:30. Date literals are available in the form form YYYY-MM-DD or YYYY/MM/DD (optionally extended by a time literal like 2020-03-22 14:45). Those values are internally interpreted as numbers representing the denoted date/time value in milliseconds.

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.

The following time zone constant is currently available in JWT for Jira Cloud:

Time zone constant

Output

RUN_AS_LOCAL

Returns the time zone of the selected Run as user.

In addition to the time zone constant above, you can specify a timezone directly as text.
Valid timezones are the ones listed in column "TZ Database Name" in List of tz database time zones, e.g. "Pacific/Auckland"

Languages

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

Currently JWT for Jira Cloud offers the following language constant: 

Language constant

Output

RUN_AS_LANG

Returns the language of the selected Run as user.

In addition to the language constant above, you can specify a language directly as text.

The most common ISO 639-1 Code locales like the two-letter version "en", or the four-letter version "en-gb" etc. are supported. The string is not case sensitive, so "EN" is valid as well. You don't have to use the hyphen(-), an underscore will work as well, i.e. "en-gb" is equivalent to "en_GB". If the language is not available (e.g. "english"), an error is returned.

Available functions

Function Short description Output
addDays()

Adds or subtracts days to or from any given date.

number

dayOfTheWeek()

Returns the day of the week of any given timestamp.

number

dateToString()

Converts any given date to a text.

text

dayOfTheMonth()

Returns the day of the month of any given timestamp.

number

second()

Returns the second part of a given timestamp.

number

dateTimeToString()

Returns the timestamp of any given date in text form.

text

hour()

Returns the hour part of any given timestamp.

number

timePart()

Returns the time part of any given date.

number

month()

Returns the month part of a given timestamp.

number

year()

Returns the year part of a timestamp.

number

stringToDate()

Converts a text into a date.

number

minute()

Returns the minutes part of a given timestamp.

number

datePart()

Returns the date part of any given date.

number