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.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>TStamp Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="tstamp">Tstamp</a></h2>
  8. <h3>Description</h3>
  9. <p>Sets the <code>DSTAMP</code>, <code>TSTAMP</code>, and <code>TODAY</code>
  10. properties in the current project. By default,
  11. the <code>DSTAMP</code> property is in the
  12. format &quot;yyyyMMdd&quot;, <code>TSTAMP</code> is in the
  13. format &quot;hhmm&quot;, and <code>TODAY</code> is in the
  14. format &quot;MMMM dd yyyy&quot;. Use the nested &lt;format&gt; element
  15. to specify a different format.</p>
  16. <p>These properties can be used in the build-file, for instance, to create
  17. time-stamped filenames, or used to replace placeholder tags inside documents
  18. to indicate, for example, the release date. The best place for this task is
  19. probably in an initialization target.</p>
  20. <h3>Parameters</h3>
  21. <table border="1" cellpadding="2" cellspacing="0">
  22. <tr>
  23. <td valign="top"><b>Attribute</b></td>
  24. <td valign="top"><b>Description</b></td>
  25. <td align="center" valign="top"><b>Required</b></td>
  26. </tr>
  27. <tr>
  28. <td valign="top">prefix</td>
  29. <td valign="top">Prefix used for all properties set. The default is no prefix.</td>
  30. <td align="center" valign="top">No</td>
  31. </tr>
  32. </table>
  33. <h3>Nested Elements</h3>
  34. The Tstamp task supports a <code>&lt;format&gt;</code> nested element that
  35. allows a property to be set to the current date and time in a given format.
  36. The date/time patterns are as defined in the Java
  37. <a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a> class.
  38. The format element also allows offsets to be applied to the time to generate different time values.
  39. <br><br>
  40. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  41. <tr>
  42. <td valign="top"><b>Attribute</b></td>
  43. <td valign="top"><b>Description</b></td>
  44. <td align="center" valign="top"><b>Required</b></td>
  45. </tr>
  46. <tr>
  47. <td valign="top">property</td>
  48. <td valign="top">
  49. The property to receive the date/time string in the given pattern.
  50. </td>
  51. <td align="center" valign="top">Yes</td>
  52. </tr>
  53. <tr>
  54. <td valign="top">pattern</td>
  55. <td valign="top">The date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class.</td>
  56. <td align="center" valign="top">Yes</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">timezone</td>
  60. <td valign="top">The timezone to use for displaying time. The values are as defined by the Java <a href="http://java.sun.com/products/jdk/1.2/docs/api/java/util/TimeZone.html">TimeZone</a> class.</td>
  61. <td align="center" valign="top">No</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">offset</td>
  65. <td valign="top">The numeric offset to the current time</td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. <tr>
  69. <td valign="top">unit</td>
  70. <td valign="top">The unit of the offset to be applied to the current time.
  71. Valid Values are
  72. <ul>
  73. <li>millisecond</li>
  74. <li>second</li>
  75. <li>minute</li>
  76. <li>hour</li>
  77. <li>day</li>
  78. <li>week</li>
  79. <li>month</li>
  80. <li>year</li>
  81. </ul>
  82. </td>
  83. <td align="center" valign="top">No</td>
  84. </tr>
  85. <tr>
  86. <td valign="top">locale</td>
  87. <td valign="top">The locale used to create date/time string. The general
  88. form is &quot;language, country, variant&quot; but either variant or variant and
  89. country may be omitted. For more information please refer to documentation
  90. for the
  91. <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Locale.html">Locale</a>
  92. class.</td>
  93. <td align="center" valign="top">No</td>
  94. </tr>
  95. </table>
  96. <h3>Examples</h3>
  97. <pre>
  98. &lt;tstamp/&gt;
  99. </pre>
  100. <p>
  101. sets the standard <code>DSTAMP</code>, <code>TSTAMP</code>,
  102. and <code>TODAY</code> properties according to the default formats.</p>
  103. <pre>
  104. &lt;tstamp&gt;
  105. &lt;format property=&quot;TODAY_UK&quot; pattern=&quot;d-MMMM-yyyy&quot; locale=&quot;en&quot;/&gt;
  106. &lt;/tstamp&gt;
  107. </pre>
  108. <p>
  109. sets the standard properties as well as the property
  110. <code>TODAY_UK</code> with the date/time pattern &quot;d-MMMM-yyyy&quot;
  111. using English locale (eg. 21-May-2001).</p>
  112. <pre>
  113. &lt;tstamp&gt;
  114. &lt;format property=&quot;touch.time&quot; pattern=&quot;MM/dd/yyyy hh:mm aa&quot;
  115. offset=&quot;-5&quot; unit=&quot;hour&quot;/&gt;
  116. &lt;/tstamp&gt;
  117. </pre>
  118. <p>
  119. Creates a timestamp, in the property touch.time, 5 hours before the current time. The format in this example
  120. is suitable for use with the &lt;touch&gt; task. The standard properties are set also.</p>
  121. <pre>
  122. &lt;tstamp prefix="start"/&gt;
  123. </pre>
  124. <p>
  125. Sets three properties with the standard formats, prefixed with "start.":
  126. <code>start.DSTAMP</code>, <code>start.TSTAMP</code>, and <code>start.TODAY</code>.</p>
  127. <hr>
  128. <p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights Reserved.</p>
  129. </body>
  130. </html>