1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
---|
2 | <!--NewPage-->
|
---|
3 | <HTML>
|
---|
4 | <HEAD>
|
---|
5 | <!-- Generated by javadoc (build 1.4.2_13) on Mon Oct 01 14:33:34 NZST 2007 -->
|
---|
6 | <TITLE>
|
---|
7 | DateUtils (Apache Ant API)
|
---|
8 | </TITLE>
|
---|
9 |
|
---|
10 | <META NAME="keywords" CONTENT="org.apache.tools.ant.util.DateUtils class">
|
---|
11 |
|
---|
12 | <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
|
---|
13 |
|
---|
14 | <SCRIPT type="text/javascript">
|
---|
15 | function windowTitle()
|
---|
16 | {
|
---|
17 | parent.document.title="DateUtils (Apache Ant API)";
|
---|
18 | }
|
---|
19 | </SCRIPT>
|
---|
20 |
|
---|
21 | </HEAD>
|
---|
22 |
|
---|
23 | <BODY BGCOLOR="white" onload="windowTitle();">
|
---|
24 |
|
---|
25 |
|
---|
26 | <!-- ========= START OF TOP NAVBAR ======= -->
|
---|
27 | <A NAME="navbar_top"><!-- --></A>
|
---|
28 | <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
---|
29 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
---|
30 | <TR>
|
---|
31 | <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
---|
32 | <A NAME="navbar_top_firstrow"><!-- --></A>
|
---|
33 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
---|
34 | <TR ALIGN="center" VALIGN="top">
|
---|
35 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
---|
36 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
---|
37 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
---|
38 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
---|
39 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
---|
40 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
---|
41 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
---|
42 | </TR>
|
---|
43 | </TABLE>
|
---|
44 | </TD>
|
---|
45 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
---|
46 | </EM>
|
---|
47 | </TD>
|
---|
48 | </TR>
|
---|
49 |
|
---|
50 | <TR>
|
---|
51 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
---|
52 | <A HREF="../../../../../org/apache/tools/ant/util/ContainerMapper.html" title="class in org.apache.tools.ant.util"><B>PREV CLASS</B></A>
|
---|
53 | <A HREF="../../../../../org/apache/tools/ant/util/DOMElementWriter.html" title="class in org.apache.tools.ant.util"><B>NEXT CLASS</B></A></FONT></TD>
|
---|
54 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
---|
55 | <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
|
---|
56 | <A HREF="DateUtils.html" target="_top"><B>NO FRAMES</B></A>
|
---|
57 | <SCRIPT type="text/javascript">
|
---|
58 | <!--
|
---|
59 | if(window==top) {
|
---|
60 | document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
---|
61 | }
|
---|
62 | //-->
|
---|
63 | </SCRIPT>
|
---|
64 | <NOSCRIPT>
|
---|
65 | <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
---|
66 | </NOSCRIPT>
|
---|
67 |
|
---|
68 | </FONT></TD>
|
---|
69 | </TR>
|
---|
70 | <TR>
|
---|
71 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
---|
72 | SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
---|
73 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
---|
74 | DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
---|
75 | </TR>
|
---|
76 | </TABLE>
|
---|
77 | <A NAME="skip-navbar_top"></A>
|
---|
78 | <!-- ========= END OF TOP NAVBAR ========= -->
|
---|
79 |
|
---|
80 | <HR>
|
---|
81 | <!-- ======== START OF CLASS DATA ======== -->
|
---|
82 | <H2>
|
---|
83 | <FONT SIZE="-1">
|
---|
84 | org.apache.tools.ant.util</FONT>
|
---|
85 | <BR>
|
---|
86 | Class DateUtils</H2>
|
---|
87 | <PRE>
|
---|
88 | java.lang.Object
|
---|
89 | <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.tools.ant.util.DateUtils</B>
|
---|
90 | </PRE>
|
---|
91 | <HR>
|
---|
92 | <DL>
|
---|
93 | <DT>public final class <B>DateUtils</B><DT>extends java.lang.Object</DL>
|
---|
94 |
|
---|
95 | <P>
|
---|
96 | Helper methods to deal with date/time formatting with a specific
|
---|
97 | defined format (<a href="http://www.w3.org/TR/NOTE-datetime">ISO8601</a>)
|
---|
98 | or a plurialization correct elapsed time in minutes and seconds.
|
---|
99 | <P>
|
---|
100 |
|
---|
101 | <P>
|
---|
102 | <DL>
|
---|
103 | <DT><B>Since:</B></DT>
|
---|
104 | <DD>Ant 1.5</DD>
|
---|
105 | </DL>
|
---|
106 | <HR>
|
---|
107 |
|
---|
108 | <P>
|
---|
109 | <!-- ======== NESTED CLASS SUMMARY ======== -->
|
---|
110 |
|
---|
111 |
|
---|
112 | <!-- =========== FIELD SUMMARY =========== -->
|
---|
113 |
|
---|
114 | <A NAME="field_summary"><!-- --></A>
|
---|
115 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
---|
116 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
---|
117 | <TD COLSPAN=2><FONT SIZE="+2">
|
---|
118 | <B>Field Summary</B></FONT></TD>
|
---|
119 | </TR>
|
---|
120 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
121 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
122 | <CODE>static java.text.DateFormat</CODE></FONT></TD>
|
---|
123 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#DATE_HEADER_FORMAT">DATE_HEADER_FORMAT</A></B></CODE>
|
---|
124 |
|
---|
125 | <BR>
|
---|
126 | Format used for SMTP (and probably other) Date headers.</TD>
|
---|
127 | </TR>
|
---|
128 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
129 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
130 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
131 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#ISO8601_DATE_PATTERN">ISO8601_DATE_PATTERN</A></B></CODE>
|
---|
132 |
|
---|
133 | <BR>
|
---|
134 | ISO8601-like pattern for date.</TD>
|
---|
135 | </TR>
|
---|
136 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
137 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
138 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
139 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#ISO8601_DATETIME_PATTERN">ISO8601_DATETIME_PATTERN</A></B></CODE>
|
---|
140 |
|
---|
141 | <BR>
|
---|
142 | ISO8601-like pattern for date-time.</TD>
|
---|
143 | </TR>
|
---|
144 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
145 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
146 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
147 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#ISO8601_TIME_PATTERN">ISO8601_TIME_PATTERN</A></B></CODE>
|
---|
148 |
|
---|
149 | <BR>
|
---|
150 | ISO8601-like pattern for time.</TD>
|
---|
151 | </TR>
|
---|
152 | </TABLE>
|
---|
153 |
|
---|
154 | <!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
---|
155 |
|
---|
156 |
|
---|
157 | <!-- ========== METHOD SUMMARY =========== -->
|
---|
158 |
|
---|
159 | <A NAME="method_summary"><!-- --></A>
|
---|
160 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
---|
161 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
---|
162 | <TD COLSPAN=2><FONT SIZE="+2">
|
---|
163 | <B>Method Summary</B></FONT></TD>
|
---|
164 | </TR>
|
---|
165 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
166 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
167 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
168 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#format(java.util.Date, java.lang.String)">format</A></B>(java.util.Date date,
|
---|
169 | java.lang.String pattern)</CODE>
|
---|
170 |
|
---|
171 | <BR>
|
---|
172 | Format a date/time into a specific pattern.</TD>
|
---|
173 | </TR>
|
---|
174 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
175 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
176 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
177 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#format(long, java.lang.String)">format</A></B>(long date,
|
---|
178 | java.lang.String pattern)</CODE>
|
---|
179 |
|
---|
180 | <BR>
|
---|
181 | Format a date/time into a specific pattern.</TD>
|
---|
182 | </TR>
|
---|
183 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
184 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
185 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
186 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#formatElapsedTime(long)">formatElapsedTime</A></B>(long millis)</CODE>
|
---|
187 |
|
---|
188 | <BR>
|
---|
189 | Format an elapsed time into a plurialization correct string.</TD>
|
---|
190 | </TR>
|
---|
191 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
192 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
193 | <CODE>static java.lang.String</CODE></FONT></TD>
|
---|
194 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#getDateForHeader()">getDateForHeader</A></B>()</CODE>
|
---|
195 |
|
---|
196 | <BR>
|
---|
197 | Returns the current Date in a format suitable for a SMTP date
|
---|
198 | header.</TD>
|
---|
199 | </TR>
|
---|
200 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
201 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
202 | <CODE>static int</CODE></FONT></TD>
|
---|
203 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#getPhaseOfMoon(java.util.Calendar)">getPhaseOfMoon</A></B>(java.util.Calendar cal)</CODE>
|
---|
204 |
|
---|
205 | <BR>
|
---|
206 | Calculate the phase of the moon for a given date.</TD>
|
---|
207 | </TR>
|
---|
208 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
209 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
210 | <CODE>static java.util.Date</CODE></FONT></TD>
|
---|
211 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#parseIso8601Date(java.lang.String)">parseIso8601Date</A></B>(java.lang.String datestr)</CODE>
|
---|
212 |
|
---|
213 | <BR>
|
---|
214 | Parse a string as a date using the ISO8601_DATE format which is
|
---|
215 | <code>yyyy-MM-dd</code></TD>
|
---|
216 | </TR>
|
---|
217 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
218 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
219 | <CODE>static java.util.Date</CODE></FONT></TD>
|
---|
220 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#parseIso8601DateTime(java.lang.String)">parseIso8601DateTime</A></B>(java.lang.String datestr)</CODE>
|
---|
221 |
|
---|
222 | <BR>
|
---|
223 | Parse a string as a datetime using the ISO8601_DATETIME format which is
|
---|
224 | <code>yyyy-MM-dd'T'HH:mm:ss</code></TD>
|
---|
225 | </TR>
|
---|
226 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
227 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
---|
228 | <CODE>static java.util.Date</CODE></FONT></TD>
|
---|
229 | <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/DateUtils.html#parseIso8601DateTimeOrDate(java.lang.String)">parseIso8601DateTimeOrDate</A></B>(java.lang.String datestr)</CODE>
|
---|
230 |
|
---|
231 | <BR>
|
---|
232 | Parse a string as a date using the either the ISO8601_DATETIME
|
---|
233 | or ISO8601_DATE formats.</TD>
|
---|
234 | </TR>
|
---|
235 | </TABLE>
|
---|
236 | <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
---|
237 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
---|
238 | <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
---|
239 | <TD><B>Methods inherited from class java.lang.Object</B></TD>
|
---|
240 | </TR>
|
---|
241 | <TR BGCOLOR="white" CLASS="TableRowColor">
|
---|
242 | <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
|
---|
243 | </TR>
|
---|
244 | </TABLE>
|
---|
245 |
|
---|
246 | <P>
|
---|
247 |
|
---|
248 | <!-- ============ FIELD DETAIL =========== -->
|
---|
249 |
|
---|
250 | <A NAME="field_detail"><!-- --></A>
|
---|
251 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
---|
252 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
---|
253 | <TD COLSPAN=1><FONT SIZE="+2">
|
---|
254 | <B>Field Detail</B></FONT></TD>
|
---|
255 | </TR>
|
---|
256 | </TABLE>
|
---|
257 |
|
---|
258 | <A NAME="ISO8601_DATETIME_PATTERN"><!-- --></A><H3>
|
---|
259 | ISO8601_DATETIME_PATTERN</H3>
|
---|
260 | <PRE>
|
---|
261 | public static final java.lang.String <B>ISO8601_DATETIME_PATTERN</B></PRE>
|
---|
262 | <DL>
|
---|
263 | <DD>ISO8601-like pattern for date-time. It does not support timezone.
|
---|
264 | <tt>yyyy-MM-ddTHH:mm:ss</tt>
|
---|
265 | <P>
|
---|
266 | <DL>
|
---|
267 | <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.tools.ant.util.DateUtils.ISO8601_DATETIME_PATTERN">Constant Field Values</A></DL>
|
---|
268 | </DL>
|
---|
269 | <HR>
|
---|
270 |
|
---|
271 | <A NAME="ISO8601_DATE_PATTERN"><!-- --></A><H3>
|
---|
272 | ISO8601_DATE_PATTERN</H3>
|
---|
273 | <PRE>
|
---|
274 | public static final java.lang.String <B>ISO8601_DATE_PATTERN</B></PRE>
|
---|
275 | <DL>
|
---|
276 | <DD>ISO8601-like pattern for date. <tt>yyyy-MM-dd</tt>
|
---|
277 | <P>
|
---|
278 | <DL>
|
---|
279 | <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.tools.ant.util.DateUtils.ISO8601_DATE_PATTERN">Constant Field Values</A></DL>
|
---|
280 | </DL>
|
---|
281 | <HR>
|
---|
282 |
|
---|
283 | <A NAME="ISO8601_TIME_PATTERN"><!-- --></A><H3>
|
---|
284 | ISO8601_TIME_PATTERN</H3>
|
---|
285 | <PRE>
|
---|
286 | public static final java.lang.String <B>ISO8601_TIME_PATTERN</B></PRE>
|
---|
287 | <DL>
|
---|
288 | <DD>ISO8601-like pattern for time. <tt>HH:mm:ss</tt>
|
---|
289 | <P>
|
---|
290 | <DL>
|
---|
291 | <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.tools.ant.util.DateUtils.ISO8601_TIME_PATTERN">Constant Field Values</A></DL>
|
---|
292 | </DL>
|
---|
293 | <HR>
|
---|
294 |
|
---|
295 | <A NAME="DATE_HEADER_FORMAT"><!-- --></A><H3>
|
---|
296 | DATE_HEADER_FORMAT</H3>
|
---|
297 | <PRE>
|
---|
298 | public static final java.text.DateFormat <B>DATE_HEADER_FORMAT</B></PRE>
|
---|
299 | <DL>
|
---|
300 | <DD>Format used for SMTP (and probably other) Date headers.
|
---|
301 | <P>
|
---|
302 | <DL>
|
---|
303 | </DL>
|
---|
304 | </DL>
|
---|
305 |
|
---|
306 | <!-- ========= CONSTRUCTOR DETAIL ======== -->
|
---|
307 |
|
---|
308 |
|
---|
309 | <!-- ============ METHOD DETAIL ========== -->
|
---|
310 |
|
---|
311 | <A NAME="method_detail"><!-- --></A>
|
---|
312 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
---|
313 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
---|
314 | <TD COLSPAN=1><FONT SIZE="+2">
|
---|
315 | <B>Method Detail</B></FONT></TD>
|
---|
316 | </TR>
|
---|
317 | </TABLE>
|
---|
318 |
|
---|
319 | <A NAME="format(long, java.lang.String)"><!-- --></A><H3>
|
---|
320 | format</H3>
|
---|
321 | <PRE>
|
---|
322 | public static java.lang.String <B>format</B>(long date,
|
---|
323 | java.lang.String pattern)</PRE>
|
---|
324 | <DL>
|
---|
325 | <DD>Format a date/time into a specific pattern.
|
---|
326 | <P>
|
---|
327 | <DD><DL>
|
---|
328 | <DT><B>Parameters:</B><DD><CODE>date</CODE> - the date to format expressed in milliseconds.<DD><CODE>pattern</CODE> - the pattern to use to format the date.
|
---|
329 | <DT><B>Returns:</B><DD>the formatted date.</DL>
|
---|
330 | </DD>
|
---|
331 | </DL>
|
---|
332 | <HR>
|
---|
333 |
|
---|
334 | <A NAME="format(java.util.Date, java.lang.String)"><!-- --></A><H3>
|
---|
335 | format</H3>
|
---|
336 | <PRE>
|
---|
337 | public static java.lang.String <B>format</B>(java.util.Date date,
|
---|
338 | java.lang.String pattern)</PRE>
|
---|
339 | <DL>
|
---|
340 | <DD>Format a date/time into a specific pattern.
|
---|
341 | <P>
|
---|
342 | <DD><DL>
|
---|
343 | <DT><B>Parameters:</B><DD><CODE>date</CODE> - the date to format expressed in milliseconds.<DD><CODE>pattern</CODE> - the pattern to use to format the date.
|
---|
344 | <DT><B>Returns:</B><DD>the formatted date.</DL>
|
---|
345 | </DD>
|
---|
346 | </DL>
|
---|
347 | <HR>
|
---|
348 |
|
---|
349 | <A NAME="formatElapsedTime(long)"><!-- --></A><H3>
|
---|
350 | formatElapsedTime</H3>
|
---|
351 | <PRE>
|
---|
352 | public static java.lang.String <B>formatElapsedTime</B>(long millis)</PRE>
|
---|
353 | <DL>
|
---|
354 | <DD>Format an elapsed time into a plurialization correct string.
|
---|
355 | It is limited only to report elapsed time in minutes and
|
---|
356 | seconds and has the following behavior.
|
---|
357 | <ul>
|
---|
358 | <li>minutes are not displayed when 0. (ie: "45 seconds")</li>
|
---|
359 | <li>seconds are always displayed in plural form (ie "0 seconds" or
|
---|
360 | "10 seconds") except for 1 (ie "1 second")</li>
|
---|
361 | </ul>
|
---|
362 | <P>
|
---|
363 | <DD><DL>
|
---|
364 | <DT><B>Parameters:</B><DD><CODE>millis</CODE> - the elapsed time to report in milliseconds.
|
---|
365 | <DT><B>Returns:</B><DD>the formatted text in minutes/seconds.</DL>
|
---|
366 | </DD>
|
---|
367 | </DL>
|
---|
368 | <HR>
|
---|
369 |
|
---|
370 | <A NAME="getPhaseOfMoon(java.util.Calendar)"><!-- --></A><H3>
|
---|
371 | getPhaseOfMoon</H3>
|
---|
372 | <PRE>
|
---|
373 | public static int <B>getPhaseOfMoon</B>(java.util.Calendar cal)</PRE>
|
---|
374 | <DL>
|
---|
375 | <DD>Calculate the phase of the moon for a given date.
|
---|
376 |
|
---|
377 | <p>Code heavily influenced by hacklib.c in <a
|
---|
378 | href="http://www.nethack.org/">Nethack</a></p>
|
---|
379 |
|
---|
380 | <p>The Algorithm:
|
---|
381 |
|
---|
382 | <pre>
|
---|
383 | moon period = 29.53058 days ~= 30, year = 365.2422 days
|
---|
384 |
|
---|
385 | days moon phase advances on first day of year compared to preceding year
|
---|
386 | = 365.2422 - 12*29.53058 ~= 11
|
---|
387 |
|
---|
388 | years in Metonic cycle (time until same phases fall on the same days of
|
---|
389 | the month) = 18.6 ~= 19
|
---|
390 |
|
---|
391 | moon phase on first day of year (epact) ~= (11*(year%19) + 18) % 30
|
---|
392 | (18 as initial condition for 1900)
|
---|
393 |
|
---|
394 | current phase in days = first day phase + days elapsed in year
|
---|
395 |
|
---|
396 | 6 moons ~= 177 days
|
---|
397 | 177 ~= 8 reported phases * 22
|
---|
398 | + 11/22 for rounding
|
---|
399 | </pre>
|
---|
400 | <P>
|
---|
401 | <DD><DL>
|
---|
402 |
|
---|
403 | <DT><B>Returns:</B><DD>The phase of the moon as a number between 0 and 7 with
|
---|
404 | 0 meaning new moon and 4 meaning full moon.<DT><B>Since:</B></DT>
|
---|
405 | <DD>1.2, Ant 1.5</DD>
|
---|
406 | </DL>
|
---|
407 | </DD>
|
---|
408 | </DL>
|
---|
409 | <HR>
|
---|
410 |
|
---|
411 | <A NAME="getDateForHeader()"><!-- --></A><H3>
|
---|
412 | getDateForHeader</H3>
|
---|
413 | <PRE>
|
---|
414 | public static java.lang.String <B>getDateForHeader</B>()</PRE>
|
---|
415 | <DL>
|
---|
416 | <DD>Returns the current Date in a format suitable for a SMTP date
|
---|
417 | header.
|
---|
418 | <P>
|
---|
419 | <DD><DL>
|
---|
420 | <DT><B>Since:</B></DT>
|
---|
421 | <DD>Ant 1.5.2</DD>
|
---|
422 | </DL>
|
---|
423 | </DD>
|
---|
424 | </DL>
|
---|
425 | <HR>
|
---|
426 |
|
---|
427 | <A NAME="parseIso8601DateTime(java.lang.String)"><!-- --></A><H3>
|
---|
428 | parseIso8601DateTime</H3>
|
---|
429 | <PRE>
|
---|
430 | public static java.util.Date <B>parseIso8601DateTime</B>(java.lang.String datestr)
|
---|
431 | throws java.text.ParseException</PRE>
|
---|
432 | <DL>
|
---|
433 | <DD>Parse a string as a datetime using the ISO8601_DATETIME format which is
|
---|
434 | <code>yyyy-MM-dd'T'HH:mm:ss</code>
|
---|
435 | <P>
|
---|
436 | <DD><DL>
|
---|
437 | <DT><B>Parameters:</B><DD><CODE>datestr</CODE> - string to be parsed
|
---|
438 | <DT><B>Returns:</B><DD>a java.util.Date object as parsed by the format.
|
---|
439 | <DT><B>Throws:</B>
|
---|
440 | <DD><CODE>java.text.ParseException</CODE> - if the supplied string cannot be parsed by
|
---|
441 | this pattern.<DT><B>Since:</B></DT>
|
---|
442 | <DD>Ant 1.6</DD>
|
---|
443 | </DL>
|
---|
444 | </DD>
|
---|
445 | </DL>
|
---|
446 | <HR>
|
---|
447 |
|
---|
448 | <A NAME="parseIso8601Date(java.lang.String)"><!-- --></A><H3>
|
---|
449 | parseIso8601Date</H3>
|
---|
450 | <PRE>
|
---|
451 | public static java.util.Date <B>parseIso8601Date</B>(java.lang.String datestr)
|
---|
452 | throws java.text.ParseException</PRE>
|
---|
453 | <DL>
|
---|
454 | <DD>Parse a string as a date using the ISO8601_DATE format which is
|
---|
455 | <code>yyyy-MM-dd</code>
|
---|
456 | <P>
|
---|
457 | <DD><DL>
|
---|
458 | <DT><B>Parameters:</B><DD><CODE>datestr</CODE> - string to be parsed
|
---|
459 | <DT><B>Returns:</B><DD>a java.util.Date object as parsed by the format.
|
---|
460 | <DT><B>Throws:</B>
|
---|
461 | <DD><CODE>java.text.ParseException</CODE> - if the supplied string cannot be parsed by
|
---|
462 | this pattern.<DT><B>Since:</B></DT>
|
---|
463 | <DD>Ant 1.6</DD>
|
---|
464 | </DL>
|
---|
465 | </DD>
|
---|
466 | </DL>
|
---|
467 | <HR>
|
---|
468 |
|
---|
469 | <A NAME="parseIso8601DateTimeOrDate(java.lang.String)"><!-- --></A><H3>
|
---|
470 | parseIso8601DateTimeOrDate</H3>
|
---|
471 | <PRE>
|
---|
472 | public static java.util.Date <B>parseIso8601DateTimeOrDate</B>(java.lang.String datestr)
|
---|
473 | throws java.text.ParseException</PRE>
|
---|
474 | <DL>
|
---|
475 | <DD>Parse a string as a date using the either the ISO8601_DATETIME
|
---|
476 | or ISO8601_DATE formats.
|
---|
477 | <P>
|
---|
478 | <DD><DL>
|
---|
479 | <DT><B>Parameters:</B><DD><CODE>datestr</CODE> - string to be parsed
|
---|
480 | <DT><B>Returns:</B><DD>a java.util.Date object as parsed by the formats.
|
---|
481 | <DT><B>Throws:</B>
|
---|
482 | <DD><CODE>java.text.ParseException</CODE> - if the supplied string cannot be parsed by
|
---|
483 | either of these patterns.<DT><B>Since:</B></DT>
|
---|
484 | <DD>Ant 1.6</DD>
|
---|
485 | </DL>
|
---|
486 | </DD>
|
---|
487 | </DL>
|
---|
488 | <!-- ========= END OF CLASS DATA ========= -->
|
---|
489 | <HR>
|
---|
490 |
|
---|
491 |
|
---|
492 | <!-- ======= START OF BOTTOM NAVBAR ====== -->
|
---|
493 | <A NAME="navbar_bottom"><!-- --></A>
|
---|
494 | <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
---|
495 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
---|
496 | <TR>
|
---|
497 | <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
---|
498 | <A NAME="navbar_bottom_firstrow"><!-- --></A>
|
---|
499 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
---|
500 | <TR ALIGN="center" VALIGN="top">
|
---|
501 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
---|
502 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
---|
503 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
---|
504 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
---|
505 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
---|
506 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
---|
507 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
---|
508 | </TR>
|
---|
509 | </TABLE>
|
---|
510 | </TD>
|
---|
511 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
---|
512 | </EM>
|
---|
513 | </TD>
|
---|
514 | </TR>
|
---|
515 |
|
---|
516 | <TR>
|
---|
517 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
---|
518 | <A HREF="../../../../../org/apache/tools/ant/util/ContainerMapper.html" title="class in org.apache.tools.ant.util"><B>PREV CLASS</B></A>
|
---|
519 | <A HREF="../../../../../org/apache/tools/ant/util/DOMElementWriter.html" title="class in org.apache.tools.ant.util"><B>NEXT CLASS</B></A></FONT></TD>
|
---|
520 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
---|
521 | <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
|
---|
522 | <A HREF="DateUtils.html" target="_top"><B>NO FRAMES</B></A>
|
---|
523 | <SCRIPT type="text/javascript">
|
---|
524 | <!--
|
---|
525 | if(window==top) {
|
---|
526 | document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
---|
527 | }
|
---|
528 | //-->
|
---|
529 | </SCRIPT>
|
---|
530 | <NOSCRIPT>
|
---|
531 | <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
---|
532 | </NOSCRIPT>
|
---|
533 |
|
---|
534 | </FONT></TD>
|
---|
535 | </TR>
|
---|
536 | <TR>
|
---|
537 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
---|
538 | SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
---|
539 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
---|
540 | DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
---|
541 | </TR>
|
---|
542 | </TABLE>
|
---|
543 | <A NAME="skip-navbar_bottom"></A>
|
---|
544 | <!-- ======== END OF BOTTOM NAVBAR ======= -->
|
---|
545 |
|
---|
546 | <HR>
|
---|
547 | Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.
|
---|
548 | </BODY>
|
---|
549 | </HTML>
|
---|