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
Business days are considered to be Monday to Friday, 9am to 6pm.
{{now.plusBusinessDays(1)}}
{{now.minusBusinessDays(1)}}
toBusinessDay/toBusinessDayBackwards
Business days are considered to be Monday to Friday, 9am to 6pm.
{{toBusinessDay}}
{{toBusinessDayBackwards}}
setTimeZone / convertToTimeZone
{{convertToTimeZone("Australia/Sydney")}}
Converts the time to what it would be in the new timezone. E.g. 7am UTC will become 5pm Sydney time. This is useful when wanting to print dates in a specific timezone or perform calculations based on the hours of a specific timezone.
{{setTimeZone("Australia/Sydney")}}
Changes the timezone but maintains the same date/time. e.g. 7am UTC will get converted to 7am Sydney time
Note: Timezones must be supplied in the {area}/{city} format e.g. America/Los_Angeles
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)}}
withNextDayOfWeek
Sets the date to the next matching day.
If you're already on that day, then it will return the next week.
You can use one of these as values: MON, TUE, WED, THU, FRI, SAT, SUN.
{{now.withNextDayOfWeek("TUE")}}
will return the next Tuesday{{now.withNextDayOfWeek("MON").withHour(14).withMinute(0)}}
will return the next Monday at 2pm
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 |
weekOfYearIso |
zoneId |
toDays |
isLeapYear |
lengthOfMonth |
lengthOfYear |
timeZoneShort |
timeZoneFull |
timeZoneNarrow |
offsetShort |
offsetFull |
offsetNarrow |