KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > apache > xerces > utils > ISO8601Format


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 1999 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Xerces" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 1999, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58
59 package org.enhydra.apache.xerces.utils;
60
61
62
63 /**
64  * This class provides ISO8601 date/time formatting conversion into
65  * Java DateFormat,
66  * This is based on ISO Internation Standard 1988-06-15
67  *
68
69
70 timeDuration
71 ============
72 PnYnMnDTnHnMnS
73
74 Years
75 Months
76 Days
77
78 Hours
79 Minutes
80 Seconds
81
82 x < y iff x-y is positive
83
84
85 recurringDuration
86 ================
87 timeDuration that recurrs from a specific origin.
88
89 2 constraining facets:
90
91   duration ( timeDuration)
92            0 a single instant of time
93
94   period ( timeDuration)
95            0 does not recurr
96
97 both duration and period should be given
98
99 CCYY-MM-DDThh:mm:ss.sss Z
100
101 Z Coordinated Universal Time -
102   difference between the local time and Coordinated Universal Time
103   +/-
104
105
106 Derived Datatype timeInstant uses same lexical
107 Date, time, timePeriod, recurringDate use truncated version
108
109 Suppose we wanted to define a day of the week i.e. a 24 hour duration that recurs every 7 days. This could be done as follows:
110 <simpleType name='dayOfWeek' base='recurringDuration'>
111     <duration value='PT24H'/>
112     <period value='P7D'/>
113 </simpleType>
114  
115
116 timeInstant
117 ===========
118
119 for Calendar Dates:
120   year - month - day - time designator - hour - minute - second
121
122 for ordinal date:
123   year - day - time designator - hour - minute - second
124
125 for dates identified by week and day numbers:
126   year - week designator - week - day - time designator - hour - minute - second
127
128 T - time designator
129 - and : are separators
130
131 T maybe omitted ub applications where there is no risk of confusing a combined date and time.
132
133 CCYYMMDDThhmmss
134 CCYYMMDDThhmm
135 CCYYMMDDThh
136
137
138 CCYY-MM-DDThh:mm:ss
139 CCYY-MM-DDThh:mm
140 CCYY-MM-DDThh
141
142 CCYYDDDThhmmss
143 CCYYDDDThhmm
144 CCYYDDDThh
145
146 CCYY-DDDThh:mm:ss
147 CCYY-DDDThh:mm
148 CCYY-DDDThh
149
150 CCYYWwwDThhmmss
151 CCYYWwwDThhmm
152 CCYYWwwDThh
153
154 CCYY-Www-DThh:mm:ss
155 CCYY-Www-DThh:mm
156 CCYY-Www-DThh
157
158
159 TimeInstant has as basetype recurrindDuration where
160 duration facet = P0Y
161 period facet = P0Y
162
163 1999-05-31T13:20:00-05:00.
164
165
166
167 time
168 ====
169 base type is recurringDuration
170 duration facet = P0Y
171 period facet = PY24H ; since this instance of time occurs every 24 hours
172
173 Time are in 24 hour period.
174
175
176 Lexical is left truncated representation for timeInstant
177 with optional following time zone indicator.
178
179 13:20:00-05:00
180
181 Basic forms
182 Extended forms
183
184 Fractions are indicated by [.] or [,].
185 Comma is preferred ( should support both).
186
187 Coordinated UTC
188 ===============
189
190 Time representation as above following immediately without spaces
191 by time-zone designator [Z].
192
193 Local Time
194 ==========
195 Time difference should be expressed only in:
196 hours minutes
197 hours
198 +/-
199 Should not be used alone!
200
201 timePeriod
202 ==========
203 baseType - recurringDuration with period face equal to "P0Y" (no recurrence
204 Domain is space of Periods of time.
205
206 So as per ISO spece is either:
207
208 a - duration of tome delimited by a specific start and specific end
209 b - quantity of time expressed in one or more specific components
210 but not associated with any specific start or end.
211 c - A quantity of time associated with a specific start.
212 d - A quantity of time associated with a specific end.
213
214 two components can be separated by a solidus [/] for a, b, and c
215
216 a) basic format:
217    CCYYMMDDThhmmss/CCYYMMDDThhmmss
218
219 b) representation of duration of time
220    Basic format: PnYnMnDTnHnMnS
221
222 c) Representation of Period identified by its start and its duration.
223    CCYYMMDDThhmmss/PnYnnMnDTnHnMnS
224
225 d) Representation of period identified by its duration and its end.
226    PnYnMnDTnHnMnS/CCYYMMDDThhmmss
227
228 date
229 ====
230
231 month
232 =====
233
234 year
235 ====
236
237 century
238 =======
239
240 recurringDate
241 =============
242
243 recurringDay
244 ============
245
246
247
248 TimeInstant
249 ===========
250
251 Combination od date and time values that represent a single instant in time
252
253 Space of Gregorian dates and legal times
254 Lexical:
255
256
257 CCYY-MM-DDThh:mm:ss.ssss
258
259 CC Century
260 YY Year
261 MM Month
262 DD day
263 Optional - by default a + is assumed or omitted
264 T date/time separator
265 hh hour
266 mm minute
267 ss.sss second , additional digits may be used
268 Additional digits to left can be added to allow for years greater than 9999
269
270 CCYY-MM-DDThh:mm:ss.ssss can be followed by a Z to indicate Coordinated Universal
271 Time.
272
273 To indicate time zone the difference between the local time and Coordinated Universal
274 Time, follows the time and consist of a sign, + or - followed by hh:mm
275
276 e.g. 1999-05-31T13:20:00-05:00
277
278 TimeDuration
279 ============
280 P1Y2M3DT10H30M
281
282 PnYnMnDTnH nMnS
283 nY number of Years
284 nM number of Hours
285 nD number of days
286 T date/time separator
287 nH number of hours
288 nM number of minutes
289 nS number of seconds
290
291
292 recurringInstant
293 ===============
294
295 Lexical
296 =======
297 Left truncated representation for timeInstant
298
299 -CC omitted from the timeInstant representation it means a timeinstant
300 that recurs every hundred years.
301 -CCYY omitted is designated a time instant that recurrs every year.
302 -Every two character "unit" of the representation that is omitted is indicated
303 by a single hyphen "-".
304 1:20 pm on May the 31st every year is
305 --05-31T13:20:00-05:00
306
307
308 */

309
310
311
312
313 /**
314  *
315  * @author Jeffrey Rodriguez
316  * @version
317  */

318
319
320 public final class ISO8601Format {
321
322 // DateFormat dateJava = 0;
323

324
325     public ISO8601Format( String JavaDoc dateString ){
326
327     }
328    
329     //public DateFormat
330

331
332     
333     /**
334      * Encodes hex octects into Base64
335      *
336      * @param binaryData Array containing binaryData
337      * @return Encoded Base64 array
338      */

339   
340 }
341
Popular Tags