Gopalan Suresh Raj
Web Cornucopia
Gopalan's Profile
Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe Download Open ESB
Syndication
Search

Table of Contents
Tags
bpel choreography ejb esb http integration javacaps javaee javaone jax-ws jbi management openesb orchestration process-oriented rest sca service-oriented soa soap wsdl xml xsd
Links
 
Referrers

Today's Page Hits: 95

Map of Visitors
Locations of visitors to this page
Caveat Emptor
This is my personal weblog. The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers. I do not speak for my employer or any past employers.
View Gopalan Suresh Raj's profile on LinkedIn
« Learn to use SOA... | Main | BPEL: How do I intro... »
Friday Jul 14, 2006
Jul
14
BPEL: Specifying Dates, Times, and duration
In XML Schema, the duration datatype is used to represent durations of time (e.g., to represent - for 19 years 10 months and 28 days, or,  for 10 hours 37 minutes and 46 seconds) which can be thought of as time intervals. Similarly, the datetime and date datatypes in XML Schema, are used to reference specific instances of time (e.g., to represent - the 28th day of the 10th month of the year 2008 or time such as 10:28:19am).

Whatever the query language used (XPath 1.0 being the default) by the BPEL Engine, the date or time expressions used in a query have to evaluate to a valid value corresponding to a duration, date or datetime datatype as defined in the XML Schema specification. All the three XML Schema datatypes use the ISO 8601 standard that uses characters appended to numbers within the date and time information. You can read more about this here from the source. I will try to make it more understandable here in this blog entry.

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 2008to 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.


Download the Java EE 5 Tools Bundle Beta from http://java.sun.com/javaee/downloads/index.jsp for FREE, and provide us feedback on the improvements you'd like to see. It combines the new Java EE 5 SDK with NetBeans IDE 5.5 Beta, NetBeans Enterprise Pack 5.5 Early Access, and Sun Java System Application Server Platform Edition 9. This bundle also contains Project Open ESB Starter Kit Beta, Java EE 5 samples, Java BluePrints, and API docs (Javadoc).


Posted at 06:06AM Jul 14, 2006 by Suresh Gopalan in BPEL  |  Listen to this article Listen to this entry  |  Comments added Comments[0]
Tags:
Share This Post: del.icio.us | furl | simpy | slashdot | technorati | digg

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Disclaimer: The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers.



View blog top tags

Enter your email address:

Delivered by FeedBurner

[Valid RSS]