flowable中的ISO8601時間格式

  • 一段時間

須組合使用,必須是P開頭,如下所示

P1DT1M - 一天一分鐘執行一次

P1W - 一週執行一次

PT1H - 一小時執行一次

PT10S - 十秒執行一次

flowable經常會用到 duration,如下圖所示,15分鐘執行一次

flowable官網的解釋是ISO8601標準

以下摘自維基百科

PT5M 表示5分鐘,P表示一段時間,T表示分割符,用來分割年月日和時分秒

Durations[edit]

PnYnMnDTnHnMnS
PnW
P<date>T<time>

Durations define the amount of intervening time in a time interval and are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W as shown to the right. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters PYMWDTHM, and S are designators for each of the date and time elements and are not replaced.

  • P is the duration designator (for period) placed at the start of the duration representation.
  • Y is the year designator that follows the value for the number of years.
  • M is the month designator that follows the value for the number of months.
  • W is the week designator that follows the value for the number of weeks.
  • D is the day designator that follows the value for the number of days.
  • T is the time designator(分割符) that precedes the time components of the representation.
    • H is the hour designator that follows the value for the number of hours.
    • M is the minute designator that follows the value for the number of minutes.
    • S is the second designator that follows the value for the number of seconds.

For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds".

Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations. However, at least one element must be present, thus "P" is not a valid representation for a duration of 0 seconds. "PT0S" or "P0D", however, are both valid and represent the same duration.

To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The smallest value used may also have a decimal fraction, as in "P0.5Y" to indicate half a year. This decimal fraction may be specified with either a comma or a full stop, as in "P0,5Y" or "P0.5Y". The standard does not prohibit date and time values in a duration representation from exceeding their "carry over points" except as noted below. Thus, "PT36H" could be used as well as "P1DT12H" for representing the same duration. But keep in mind that "PT36H" is not the same as "P1DT12H" when switching from or to Daylight saving time.

Alternatively, a format for duration based on combined date and time representations may be used by agreement between the communicating parties either in the basic format PYYYYMMDDThhmmss or in the extended format P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]. For example, the first duration shown above would be "P0003-06-04T12:30:05". However, individual date and time values cannot exceed their moduli (e.g. a value of 13 for the month or 25 for the hour would not be permissible).[31]

Although the standard describes a duration as part of time intervals, which are discussed in the next section, the duration format (or a subset thereof) is widely used independent of time intervals, as with the Java 8 Duration class[32][33].

  • 一段時間重複

格式解析

R2/2015-06-04T19:25:16.828696-07:00/P1DT10S

上面的字符串通過"/"分爲了三部分即:

重複次數/開始時間/運行間隔

重複次數

  • R - 將永遠重複
  • R1 - 將重複一次
  • R231 - 將重複231次。

開始時間


其中"T"用來分割日期和時間,時間後面跟着的"-07:00"表示西七區,注意"-"是連字符,不是減號。

時區默認是0時區,可以用"Z"表示,也可以不寫。

對於我國,要使用"+08:00",表示東八區。
上面的字符串表示 2015年6月4日,19點25分16秒828696納秒,西七區。

運行間隔

運行間隔以"P"開始,和上面一樣也是用"T"分割日期和時間,如P1Y2M10DT2H30M15S

  • P 開始標記
  • 1Y - 一年
  • 2M - 兩個月
  • 10D - 十天
  • T - 時間和日期分的割標記
  • 2H - 兩個小時
  • 30M - 三十分鐘
  • 15S 十五秒鐘

須組合使用,必須是P開頭,如下所示

  • P1DT1M - 一天一分鐘執行一次
  • P1W - 一週執行一次
  • PT1H - 一小時執行一次
  • PT10S - 十秒執行一次

ISO8601中文維基百科

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章