Date and Time functions

now

Smart value to reference the current date and time:

{{now}}
{{now.plusDays(7).jqlDate}}

Date formats

For example:

{{now.jiraDate}}
{{now.format("dd/MM/yyyy")}}
{{now.shortDate}}
Format Thursday, November 1, 1979 6:23:12 AM EST
Default (none specified) Nov 1, 1979 6:23:12 AM
jiraDate 1979-11-01
jiraDateTime 1979-11-01T06:23:12.0-0500
jqlDate 1979-11-01
jqlDateTime 1979-11-01 06:23
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
format("<pattern>") e.g. format("dd/MM/yyyy")

Please refer to Java documentation for pattern syntax.
01/11/1979

diff(date)

{{now.diff(issue.created).days}}

Units available:

  • millis
  • seconds
  • minutes
  • hours
  • days
  • weeks
  • months
  • years
  • businessDays
  • prettyPrint
  • abs

"prettyPrint" displays the difference in words. E.g. 2 days 3 hours

isAfter(date)

{{now.isAfter(issue.created)}} (returns true/false)

isBefore(date)

{{now.isBefore(issue.created)}} (returns true/false)

isEquals(date)

{{now.isEquals(now)}} (returns true/false)

compareTo(date)

{{now.compareTo(issue.created)}} (returns number)
{{issue.created.compareTo(now)}} (returns number)
{{now.compareTo(now)}} returns 0

plusDays / minusDays

{{now.plusDays(1)}}
{{now.minusDays(1)}}

plusHours / minusHours

{{now.plusHours(1)}}
{{now.minusHours(1)}}

plusWeeks / minusWeeks

{{now.plusWeeks(1)}}
{{now.minusWeeks(1)}}

plusMillis / minusMillis

{{now.plusMillis(1)}}
{{now.minusMillis(1)}}

plusMinutes / minusMinutes

{{now.plusMinutes(1)}}
{{now.minusMinutes(1)}}

plusMonths / minusMonths

{{now.plusMonths(1)}}
{{now.minusMonths(1)}}

plusSeconds / minusSeconds

{{now.plusSeconds(1)}}
{{now.minusSeconds(1)}}

plusYears / minusYears

{{now.plusYears(1)}}
{{now.minusYears(1)}}

plusBusinessDays/minusBusinessDays

{{now.plusBusinessDays(1)}}
{{now.minusBusinessDays(1)}}

toBusinessDay/toBusinessDayBackwards

{{toBusinessDay}}
{{toBusinessDayBackwards}}

setTimeZone / convertToTimeZone

{{setTimeZone("Australia/Sydney")}}
{{convertToTimeZone("Australia/Sydney")}}

To date with time conversion

The following functions can be used to convert a date to a date with a time component:

{{now.toStartOfDay}}
{{now.toCurrentTime}}
{{now.toDateTimeAtStartOfDay}}
{{now.toDateTimeAtStartOfDay(timezone)}}
{{now.toDateTimeAtCurrentTime}}
{{now.toDateTimeAtCurrentTime(timezone)}}

withDayOfMonth

{{now.withDayOfMonth(15)}}

withHour

{{now.withHour(20)}}

withMillis

{{now.withMillis(500)}}

withMinute

{{now.withMinute(59)}}

withMonth

{{now.withMonth(10)}}

withSecond

{{now.withSecond(0)}}

withYear

{{now.withYear(1979)}}

withDayOfYear

{{now.withDayOfYear(355)}}

Set the day component of the date

{{now.endOfMonth}}
{{now.startOfMonth}}
{{now.firstBusinessDayOfMonth}}
{{now.lastBusinessDayOfMonth}}

// Parameters: day of week (1-7) 
{{now.firstOfTheMonth(1)}}
{{now.lastOfTheMonth(1)}}

// Parameters: nth of month (1-5), day of week (1-7)
{{now.ofTheMonth(2, 1)}}

Attributes

Attributes
millis
second
minute
hour
dayOfMonth
monthOfYear
year
dayOfYear
dayOfWeek
dayOfWeekName
dayOfWeekShortName
weekOfYear
zoneId
toDays
isLeapYear
lengthOfMonth
lengthOfYear
timeZoneShort
timeZoneFull
timeZoneNarrow
offsetShort
offsetFull
offsetNarrow