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 4.5 KiB

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