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中文维基百科

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