Time Structure
Time
Time structure is defined as
Â
Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07) Complete date: YYYY-MM-DD (eg 1997-07-16) Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) Complete date plus hours, minutes and seconds: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
Â
where:
Â
YYYY = four-digit year MM = two-digit month (01=January, etc.) DD = two-digit day of month (01 through 31) hh = two digits of hour (00 through 23) (am/pm NOT allowed) mm = two digits of minute (00 through 59) ss = two digits of second (00 through 59) s = one or more digits representing a decimal fraction of a second TZD = time zone designator (Z or +hh:mm or -hh:mm)
DateTime can be formatted by using system defined function - SimpleDateFormat.
Examples:
<DateTime name="Time" format="$SimpleDateFormat(yyyy-MM-dd'T'HH:mm:ss.SSSZ)"/>
<Attribute name="Time" value="Record.Time" format="$SimpleDateFormat(yyyy.MM.dd G 'at' HH:mm:ss z)"/>
<DateTime name="LastLogin" format="$SimpleDateFormat(yyyy-MM-dd':'HH:mm:ss)"/>
Duration
The duration data type is used to specify a time interval.
The time interval is specified in the following form "PnYnMnDTnHnMnS" where:
- P indicates the period (required)
- nY indicates the number of years
- nM indicates the number of months
- nD indicates the number of days
- T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
- nH indicates the number of hours
- nM indicates the number of minutes
- nS indicates the number of seconds
The following is an example of a duration declaration might look like this:
       <period>P5Y</period>
The example above indicates a period of five years.
Or it might look like this:
        <period>P5Y2M10D</period>
The example above indicates a period of five years, two months, and 10 days.
Or it might look like this:
       <period>P5Y2M10DT15H</period>
The example above indicates a period of five years, two months, 10 days, and 15 hours.
Or it might look like this:
      <period>PT15H</period>
The example above indicates a period of 15 hours.
Negative Duration
To specify a negative duration, enter a minus sign before the P:
       <period>-P10D</period>
The example above indicates a period of minus 10 days. Â