スマート バリュー - 日付と時刻の関数

Jira のプロセスとワークフローを自動化する

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

robotsnoindex
robotsnoindex

日付と時間の各フィールドにアクセスして形式を設定するには、次のスマート バリューを利用します。 

Check out how we use smart values in our Jira automation template library.

For more examples of how these smart values can be used, see Use smart values to manipulate and format dates.

{{now}}

Returns the current date and time.

If the current date and time is August 18, 2020, 2:40am UTC:

{{now}}

// returns

2020-08-18T02:40:37.0+0000

{{[date].[dateformat]}}

Takes a date and time that you provide, and returns it in a format of your choosing. This is useful for converting the default output for dates (jiraDateTime), to a format that is easier to read. You can add a dateformat to the end of any of the date smart values listed on this page.

The full list of formats are below:

形式

1979 年 11 月 1 日、木曜日、6:23:12 AM EST

初期設定 (指定なし)

1979 年 11 月 1 日、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

1979 年 11 月 1 日

mediumTime

6:23:12 AM

mediumDateTime

1979 年 11 月 1 日、6:23:12 AM

longDate

1979 年 11 月 1 日

longTime

6:23:12 AM EST

longDateTime

1979 年 11 月 1 日、6:23:12 AM EST

fullDate

Thursday, November 1, 1979

fullTime

6:23:12 AM EST

fullDateTime

1979 年 11 月 1 日、木曜日、6:23:12 AM EST

format("<pattern>") e.g. format("dd/MM/yyyy")

Refer to the Java documentation for pattern syntax.

01/11/1979

{{now.jiraDate}}

//returns

2020-08-18
This issue was created on {{issue.created.format("dd/MM/yyyy")}}

//returns

This issue was created on 18/08/2020
This issue was updated at {{issue.updated.shortTime}}.


//returns


This issue was updated at 2:40 AM.

{{[date1].diff([date2]).[unit]}}

Returns the amount of time between date1 and date2, in the unit specified. If date2 is earlier than date1, the value returned will be negative. You can combine this with the smart value to return a positive value. 

The units that can be used with this smart value are:

  • millis

  • minutes

  • days

  • weeks

  • businessDays

You can also change the format of the output using the following:

  • prettyPrint - displays the difference in words, e.g.: 2 days 3 hours.

  • abs - returns the value as a positive number.

For an issue was created 4 weeks ago:

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


//returns


-4
This issue was created {{now.diff(issue.created).weeks.abs}} weeks ago.

//returns

This issue was created 4 weeks ago.

{{[date1].isAfter([date2])}}

Returns true if date1 is after date2, and false if not.

{{now.isAfter(issue.created)}}

//returns

true

{{[date1].isBefore([date2])}}

Returns true if date1 is before date2, and false if not.

{{now.isBefore(issue.created)}}

//returns

false

{{[date1].isEquals[(date2)]}}

Returns true if date1 and date2 are the same, and false if not.

{{issue.updated.isEquals(issue.created)}}

//returns

false

{{[date1].compareTo([date2])}}

Compares date1 to date2, to find which date is earlier. Returns: 

  • -1, if date1 is earlier than date2
  • 1, if date2 is earlier than date1
  • 0, if the two dates are the same

{{issue.duedate.compareTo(now)}}

//returns

-1 or 1
{{now.compareTo(now)}}

//returns

0

{{[date].plus[Unit]([number])}}

Takes the given date and time, adds the number of the unit specified, and returns the resulting date and time. The units that can be used are:

  • Millis

  • BusinessDays (business days are considered to be Monday to Friday, 9am to 6pm)

{{sprint.startDate.plusDays(14)}}

//returns

2020-08-20T23:27:54.2+0000

If the current value of {{now}} is 2020-08-20T13:12:03.1+0000:

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

//returns

2:12 PM
{{now.plusWeeks(3)}}

//returns

2020-09-10T13:12:03.1+0000:

{{[date].minus[Unit]([number])}}

Takes the given date and time, subtracts the number of the unit specified, and returns the resulting date and time. The units that can be used are:

  • Millis

  • BusinessDays (business days are considered to be Monday to Friday, 9am to 6pm.)

{{now.minusDays(5)}}

//returns

2020-08-20T23:27:54.2+0000
{{now.minusWeeks(7)}}

//returns

2020-07-02T13:12:03.1+0000:
{{now.minusHours(5).shortTime}}

//returns

8:12 AM

{{[date].toBusinessDay}}

Takes the given date, and returns the next business date.

If the value of {{now}} is 2020-08-30T23:36:28.7+0000:

{{now.toBusinessDay}}

//returns

2020-08-31T23:36:28.7+0000

{{[date].toBusinessDayBackwards}}

Takes the given date, and returns the previous business day.

If the value of {{now}} is 2020-08-30T23:36:28.7+0000:

{{now.toBusinessDayBackwards}}

//returns

2020-08-28T23:36:28.7+0000

{{[date].setTimeZone([timezone])}}

Takes a given time, and sets (not converts) that time to the given time zone. i.e.: It prints that same time, but simply changes the timezone. You can find valid inputs for timezones here (see Canonical ID column).

If the value of {{now}} is 2020-08-30T03:17:06.2+0000:

{{now.setTimeZone("Australia/Sydney")}}

//returns

2020-08-30T03:17:06.2+1000

{{[date].convertToTimeZone([timezone])}}

Takes a given time, and converts it to the time in the given time zone. You can find valid inputs for timezones here (see Canonical ID column).

If the value of {{now}} is 2020-08-30T03:17:06.2+0000:

{{now.convertToTimeZone("Australia/Sydney").shortTime}}

//returns

1:17 PM

日付から日時への変換

Takes a given date, and converts it to a date with a time component.

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

{{[date].withDayOfMonth([date])}}

Takes a given date and time, and returns that same date and time, but with the day of the month set to the date that was inputted.

If the value of {{now}} is 2020-08-30T03:17:06.2+0000:

{{now.withDayOfMonth(15)}}


// returns


2020-08-15T03:17:06.2+0000:

{{[date].withNextDayOfWeek(["day"])}}

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 the following values: MON, TUE, WED, THU, FRI, SAT, SUN.

{{now.withNextDayOfWeek("TUE")}} will return the next Tuesday.


{{[date].with[attribute](input)}}

Takes a given date and time, and sets the date or time to whatever is described in the attribute.

Available attributes

  • millis

  • second

  • 時間

  • monthOfYear

  • dayOfYear

  • dayOfWeek

  • dayOfWeekName

  • dayOfWeekShortName

  • weekOfYear

  • zoneId

  • toDays

  • isLeapYear

  • lengthOfMonth

  • lengthOfYear

  • timeZoneShort

  • timeZoneFull

  • timeZoneNarrow

  • offsetShort

  • offsetFull

  • offsetNarrow

If the value of {{now}} is 2020-08-30T03:17:06.2+0000:

{{now.withYear(2005)}}

//returns

2005-08-30T03:17:06.2+0000
{{now.withDayOfYear(355)}}

//returns

2020-12-20T03:17:06.2+0000
{{now.withNextDayOfWeek("MON").withHour(14).withMinute(0)}} will return the next Monday at 2pm

日付の曜日コンポーネントを設定します

Takes a given date, and returns that date with the day component set to whatever was inputted.

{{[date].endOfMonth}}

Returns the date and time of the end of the month.

{{now.endOfMonth}}

{{[date].startOfMonth}}

Returns the date and time of the start of the month.

{{now.startOfMonth}}

{{[date].firstBusinessDayOfMonth}}

Returns the first business day of the month. Business days are considered to be Monday to Friday, 9am to 6pm.

{{now.firstBusinessDayOfMonth}}

{{[date].lastBusinessDayOfMonth}}

Returns the last business day of the month. Business days are considered to be Monday to Friday, 9am to 6pm.

{{now.lastBusinessDayOfMonth}}

{{[date].firstOfTheMonth(input)}}

Takes the given date, and returns the first specified day of the month. The following inputs correspond to the following days:

  • 1 - Monday
  • 2 - Tuesday
  • 3 - Wednesday
  • 4 - Thursday
  • 5 - Friday
  • 6 - Saturday
  • 7 - Sunday

If the value of {{now}} is 2020-09-01T03:17:06.2+0000, then {{now.firstOfTheMonth(1)}} will return the first Monday of September, 2020

{{now.firstOfTheMonth(1)}}


//returns


2020-09-07T03:17:06.2+0000

{{[date].lastOfTheMonth(input)}}

Takes the given date, and returns the last day of the month. The following inputs correspond to the following days:

  • 1 - Monday
  • 2 - Tuesday
  • 3 - Wednesday
  • 4 - Thursday
  • 5 - Friday
  • 6 - Saturday
  • 7 - Sunday

If the value of {{now}} is 2020-09-01T03:17:06.2+0000, then {{now.lastOfTheMonth(5)}} will return the last Friday of September, 2020

{{now.lastOfTheMonth(5)}}


//returns


2020-09-25T03:17:06.2+0000

{{[date].OfTheMonth(n, day)}}

Takes the given date, and returns the nth day of that month. If the value of {{now}} is 2020-09-01T03:17:06.2+0000, then {{now.OfTheMonth(2, 1)}} will return the second Monday of September, 2020.

{{now.ofTheMonth(2, 1)}}


//returns


2020-09-14T03:17:06.2+0000


最終更新日 2020 年 11 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.