Deprecated Date Syntax

We dramatically improved date handling in November 2018. This documentation relates to rules created in versions before that date. In Server this is 4.1.5


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

Where to use

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

Referencing the current date/time

You can reference the current date and time using {{now}}.

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 just 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:

Format Thursday, November 1, 1979 6:23:12 AM EST Notes
Default (none specified) Nov 1, 1979 6:23:12 AM If no format is specified it defaults to mediumDateTime. This may not work if used as the input for some fields
jiraDate 1979-11-01 This is the format expected for Jira fields of the type Date
jiraDateTime 1979-11-01T06:23:12.0-0500 This is the format expected for Jira fields of the type Date Time
jqlDate 1979-11-01 This is the format for dates in JQL
jqlDateTime 1979-11-01 06:23 This is the JQL format for Date Times
toMillis 310303392034 This is how many milliseconds have passed since Epoch
toSeconds 310303392 This is how many seconds have passed since Epoch
toMinutes 5171723 This is how many minutes have passed since Epoch
toHours 86195 This is how many hours have passed since Epoch
toDays 3591 This is how many days have passed since Epoch
shortDate 11/1/79
shortTime 6:23 AM
shortDateTime 11/1/79 6:23 AM
mediumDate Nov 1, 1979
mediumTime 6:23:12 AM
mediumDateTime Nov 1, 1979 6:23:12 AM
longDate November 1, 1979
longTime 6:23:12 AM EST
longDateTime November 1, 1979 6:23:12 AM EST
fullDate Thursday, November 1, 1979
fullTime 6:23:12 AM EST
fullDateTime Thursday, November 1, 1979 6:23:12 AM EST
<pattern> e.g. dd/MM/yyyy 01/11/1979 Please refer to Joda documentation for pattern syntax.

Time zone

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

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

// This will print out the time in Sydney when the issue was created.

Available time zones are available in the Joda documentation.

You can also specify a user's timezone:

// This will print out the time in the reports time zone.

Locale (language)

By default dates are output in english. To specify another locale you must specify the parameter:

// This will print out the time in Sydney when the issue was created.

Available locales are available in the Java documentation.

Manipulating dates

You can also manipulate dates by setting particular parts of the date or add/subtracting values from it:

// This will add 7 days to the current time
// You can chain functions.
// This will set the day to the fist of the month and month to November

Functions available:

plusDays / minusDays
plusHours / minusHours
plusMillis / minusMillis
plusMinutes / minusMinutes
plusMonths / minusMonths
plusSeconds / minusSeconds
plusWeeks / minusWeeks
plusYears / minusYears

Calculating business days

We have 2 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. Business days are considered Monday through Friday.

// finds the next business day
// finds the next business day after 3 days
// finds the previous business day

// adds 6 business days to today

// gets the number of weekday days beeween two dates
{{#now}}func=businessDaysBetween({{issue.created}}), format="toDays"{{/}}

Calculating the difference between two dates

You can do this using the "toSecond" format and the "minusSeconds" function to subtract one date from the other. You 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 you can use.

// how many hours since an issue has been created you can do the following
{{#now}}func=minusSeconds({{#issue.created}}toSeconds{{/}}), format="toHours"{{/}}

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

Converting strings to dates

Sometimes you have a value that you is a date but is stored as a string. E.g. in the changelog, dates are stored as strings. You can convert any string into a date simply using:


This will convert the string into a date if it is in the right format. You can also specify the format to convert from by adding the param. The example below will convert String formatted like: "2017 6 11" into Date objects.

{{issue.summary.toDate("yyyy MM dd")}}

Note that once you've converted to a Date object, you'll probably still need to transform it further. For fieldChanged (e.g. listening for a change in date}



// 1st of may this year

// 1st of may next year

// last day of May

// first business day in May

// last business day in May