Archived date functions

If you have rules that were created in server before November 2018 (server 4.1.5), then this is for you. If you are using cloud, this does not apply and instead of reading this, you can go and enjoy a cup of tea and a chocolate digestive.

Date functions and attributes are in the date reference section.


While the following syntax continues to work, it's highly recommended to use the newer dates syntax. Not only is it simpler to use, but it's more powerful and has a lot of bugs fixed in it.

Automation for Jira allows you to manipulate and format dates inside fields that support Smart Values, created, updated, duedate, resolutiondate, as well as the Date Picker custom fields, e.g. {{issue.MyDateFieldName}} or {{issue.customfield_12356}}.

Formatting dates

You can specify the format of the date in 2 ways:

Specifying format

// To format a date field value

// When no other fields are specified, you can include the format
// When you specify timezone or a function to manipulate the date you need
// to explicitly label the format and include the value in double quotes.

There are a number of built-in formats or you can specify your own:

FormatThursday, November 1, 1979 6:23:12 AM ESTNotes
Default (none specified)Nov 1, 1979 6:23:12 AMIf no format is specified it defaults to mediumDateTime. This may not work if used as the input for some fields
toMillis310303392034This is how many milliseconds have passed since Epoch
toSeconds310303392This is how many seconds have passed since Epoch
toMinutes5171723This is how many minutes have passed since Epoch
toHours86195This is how many hours have passed since Epoch
toDays3591This is how many days have passed since Epoch

Time zone

By default dates are displayed for the time zone as "UTC". This is the timezone of the Jira servers for OnDemand/Cloud and the default timezone used when allocating scheduled triggers.

To specify another time zone you need to add a parameter:

// Prints the time in Sydney when the issue was created.

Time zones are available in the Joda documentation.

Specify a user's timezone:

// Prints the time in the reporters time zone.

Language (locale)

By default, dates are in English. To specify another locale, specify the parameter:

// Prints the time in Sydney when the issue was created.

Available locales are available in the Java documentation.

Manipulating dates

Manipulate dates by setting particular parts of the date or add/subtracting values from it:

// Adds 7 days to the current time
// You can chain functions.
// Sets the day to the first of November

Calculating business days

There are two sets of functions built in to work with business days - you can either plus/minus business days from the current date or find the closest business day to the current date.

// The next business day
// The next business day after 3 days
// The previous business day

// Adds 6 business days to today

// The number of business days between when the issue was created and today
{{#now}}func=businessDaysBetween({{issue.created}}), format="toDays"{{/}}

Calculating the difference between two dates

Use the "toSecond" format and the "minusSeconds" function to subtract one date from the other. Then use one of the formats that displays how many seconds, minutes, hours or days. There's also a shortcut method called daysBetween with simpler syntax.

// The number of hours since an issue was created
{{#now}}func=minusSeconds({{#issue.created}}toSeconds{{/}}), format="toHours"{{/}}

// The number of days between two dates
{{#now}}func=daysBetween({{issue.created}}), format="toDays"{{/}}


// May 1st this year

// May 1st next year

// Last day of May

// First business day in May

// Last business day in May
Last modified on Oct 26, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.