You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tstamp.html 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>TStamp Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="tstamp">Tstamp</a></h2>
  23. <h3>Description</h3>
  24. <p>Sets the <code>DSTAMP</code>, <code>TSTAMP</code>, and <code>TODAY</code>
  25. properties in the current project. By default,
  26. the <code>DSTAMP</code> property is in the
  27. format &quot;yyyyMMdd&quot;, <code>TSTAMP</code> is in the
  28. format &quot;hhmm&quot;, and <code>TODAY</code> is in the
  29. format &quot;MMMM dd yyyy&quot;. Use the nested <code>&lt;format&gt;</code> element
  30. to specify a different format.</p>
  31. <p>These properties can be used in the build-file, for instance, to create
  32. time-stamped filenames, or used to replace placeholder tags inside documents
  33. to indicate, for example, the release date. The best place for this task is
  34. probably in an initialization target.</p>
  35. <h3>Parameters</h3>
  36. <table border="1" cellpadding="2" cellspacing="0">
  37. <tr>
  38. <td valign="top"><b>Attribute</b></td>
  39. <td valign="top"><b>Description</b></td>
  40. <td align="center" valign="top"><b>Required</b></td>
  41. </tr>
  42. <tr>
  43. <td valign="top">prefix</td>
  44. <td valign="top">Prefix used for all properties set. The default is no prefix.</td>
  45. <td align="center" valign="top">No</td>
  46. </tr>
  47. </table>
  48. <h3>Nested Elements</h3>
  49. The Tstamp task supports a <code>&lt;format&gt;</code> nested element that
  50. allows a property to be set to the current date and time in a given format.
  51. The date/time patterns are as defined in the Java
  52. <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a> class.
  53. The format element also allows offsets to be applied to the time to generate different time values.
  54. <br><br>
  55. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  56. <tr>
  57. <td valign="top"><b>Attribute</b></td>
  58. <td valign="top"><b>Description</b></td>
  59. <td align="center" valign="top"><b>Required</b></td>
  60. </tr>
  61. <tr>
  62. <td valign="top">property</td>
  63. <td valign="top">
  64. The property to receive the date/time string in the given pattern.
  65. </td>
  66. <td align="center" valign="top">Yes</td>
  67. </tr>
  68. <tr>
  69. <td valign="top">pattern</td>
  70. <td valign="top">The date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class.</td>
  71. <td align="center" valign="top">Yes</td>
  72. </tr>
  73. <tr>
  74. <td valign="top">timezone</td>
  75. <td valign="top">The timezone to use for displaying time. The values are as defined by the Java <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimeZone.html">TimeZone</a> class.</td>
  76. <td align="center" valign="top">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">offset</td>
  80. <td valign="top">The numeric offset to the current time</td>
  81. <td align="center" valign="top">No</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">unit</td>
  85. <td valign="top">The unit of the offset to be applied to the current time.
  86. Valid Values are
  87. <ul>
  88. <li>millisecond</li>
  89. <li>second</li>
  90. <li>minute</li>
  91. <li>hour</li>
  92. <li>day</li>
  93. <li>week</li>
  94. <li>month</li>
  95. <li>year</li>
  96. </ul>
  97. </td>
  98. <td align="center" valign="top">No</td>
  99. </tr>
  100. <tr>
  101. <td valign="top">locale</td>
  102. <td valign="top">The locale used to create date/time string. The general
  103. form is &quot;language, country, variant&quot; but either variant or variant and
  104. country may be omitted. For more information please refer to documentation
  105. for the
  106. <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Locale.html">Locale</a>
  107. class.</td>
  108. <td align="center" valign="top">No</td>
  109. </tr>
  110. </table>
  111. <h3>Examples</h3>
  112. <pre>
  113. &lt;tstamp/&gt;
  114. </pre>
  115. <p>
  116. sets the standard <code>DSTAMP</code>, <code>TSTAMP</code>,
  117. and <code>TODAY</code> properties according to the default formats.</p>
  118. <pre>
  119. &lt;tstamp&gt;
  120. &lt;format property=&quot;TODAY_UK&quot; pattern=&quot;d-MMMM-yyyy&quot; locale=&quot;en,UK&quot;/&gt;
  121. &lt;/tstamp&gt;
  122. </pre>
  123. <p>
  124. sets the standard properties as well as the property
  125. <code>TODAY_UK</code> with the date/time pattern &quot;d-MMMM-yyyy&quot;
  126. using English locale (eg. 21-May-2001).</p>
  127. <pre>
  128. &lt;tstamp&gt;
  129. &lt;format property=&quot;touch.time&quot; pattern=&quot;MM/dd/yyyy hh:mm aa&quot;
  130. offset=&quot;-5&quot; unit=&quot;hour&quot;/&gt;
  131. &lt;/tstamp&gt;
  132. </pre>
  133. <p>
  134. Creates a timestamp, in the property touch.time, 5 hours before the current time. The format in this example
  135. is suitable for use with the <code>&lt;touch&gt;</code> task. The standard properties are set also.</p>
  136. <pre>
  137. &lt;tstamp prefix="start"/&gt;
  138. </pre>
  139. <p>
  140. Sets three properties with the standard formats, prefixed with "start.":
  141. <code>start.DSTAMP</code>, <code>start.TSTAMP</code>, and <code>start.TODAY</code>.</p>
  142. </body>
  143. </html>