Monday, June 30, 2014

PnYnMnDTnHnMnS DateTime Format

Specifying a duration:
Time durations are specified in the format:
PnYnMnDTnHnMnS
where,
P - is a required character that represents period, the duration designator. All duration expressions always start with a P
Y - is the year designator. For example, to indicate 19 years, you'd use19Y
M - is the month designator. For example, to indicate 10 years, you'd use10M
D - is the days designator. For example, to indicate 28 days, you'd use 28D
T - is an optional character that indicates the start of the time duration
H - is the hour designator. For example, to indicate 10 hours, you'd use10H
M - is the minute designator. For example, to indicate 37 minutes, you'd use 37M
S - is the seconds designator. For example, to indicate 46 seconds, you'd use 46S

duration samples:
So to specify a duration of 19 years, 10 months, 28 days, 10 hours, 37 minutes, and 46 seconds, the duration expression would look like P19Y10M28DT10H37M46S. If you want to use it in a BPEL <wait> activity, it would read:
<wait for="'P19Y10M28DT10H37M46S'"/>
which means wait for a duration of 19 years, 10 months, 28 days, 10 hours, 37 minutes, and 46 seconds.

Similarly, to specify a duration of 1 year, 2 months, and 3 days, the duration expression would look like P1Y2M3D. If you want to use it in a BPEL <wait> activity, it would read:
<wait for="'P1Y2M3D'"/>
which means wait for a duration of 1 year, 2 months, and 3 days.

Similarly, to specify a duration of 1 hour, and 2 minutes, the duration expression would look like PT1H2M. If you want to use it in a BPEL <wait> activity, it would read:
<wait for="'PT1H2M'"/>
which means wait for a duration of 1 hour, and 2 minutes.

Specifying date and time:
Specific date and time references have the form:
CCYY-MM-DDThh:mm:ss
where,
CC - is the century designator, specified as 2 or more digits. Valid range from 00 to ...
YY - is the year designator, specified as 2 digits. Valid range from 00 to 99.
MM - is the month designator, specified as 2 digits. Valid range from 01 to 12.
DD - is the day designator, specified as 2 digits. Valid range from 01 to 31.
T - indicates the start of the time designator.
hh - is the hour designator, specified as 2 digits. Valid range from 00 to 23.
mm - is the minute designator, specified as 2 digits. Valid range from 00 to 59.
ss - is the seconds designator, specified as 2 digits with an optional decimal value allowed of the form ss.ssss to increase precision. Valid range from 00 to 59.
z - is the optional Coordinated Universal Time (UTC). If present, it should immediately follow the time element. To specify an offset from the UTC time, append a positive(+) or negative(-) time to the datetime value of the form hh:mm.

datetime samples:
So, to specify 10:28:19am, 28th October 2008, the datetime expression would look like 2008-10-28T10:28:19. If you want to use it in a BPEL <wait> activity, it would read:
<wait until="'2008-10-28T10:28:19'"/>
which means wait until the deadline 10:28:19am, 28th October 2008.

Similarly, to specify 07:30:00pm, the datetime expression would look like 19:30:00. If you want to use it in a BPEL<wait> activity, it would read:
<wait until="'19:30:00'"/>
which means wait until the deadline 07:30:00pm.

UTC datetime samples:
Similarly, to specify 10:28:19am in UTC, the datetime expression would look like 10:28:19z. If you want to use it in a BPEL <wait> activity, it would read:
<wait until="'10:28:19z'"/>
which means wait until the deadline 10:28:19am, in UTC.

Similarly, if the UTC time was 6:30:19pm 28th October 2008, to specify 10:30:19am, 28th October 2008 California time (Pacific Standard Time which is UTC-08:00), the datetime expression would look like 2008-10-28T18:30:19-08:00. If you want to use it in a BPEL <wait> activity, it would read:
<wait until="'2008-10-28T18:30:19-08:00'"/>
which means wait until the deadline 10:30:19am, 28th October 2008 California time(Pacific Standard Time).

Similarly, if the UTC time was 10:00:19am 28th October 2008,  to specify 03:30:19pm, 28th October 2008 Indian Standard time (which is UTC+05:30), the datetime expression would look like 2008-10-28T10:00:19+05:30. If you want to use it in a BPEL <wait> activity, it would read:
<wait until="'2008-10-28T10:00:19+05:30'"/>
which means wait until the deadline 03:30:19pm, 28th October 2008 Indian standard time.