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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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">offset</td>
  55. <td valign="top">The numeric offset to the current time</td>
  56. <td align="center" valign="top">No</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">unit</td>
  60. <td valign="top">The unit of the offset to be applied to the current time.
  61. Valid Values are
  62. <ul>
  63. <li>millisecond</li>
  64. <li>second</li>
  65. <li>minute</li>
  66. <li>hour</li>
  67. <li>day</li>
  68. <li>week</li>
  69. <li>month</li>
  70. <li>year</li>
  71. </ul>
  72. </td>
  73. <td align="center" valign="top">No</td>
  74. </tr>
  75. <tr>
  76. <td valign="top">locale</td>
  77. <td valign="top">The locale used to create date/time string. The general
  78. form is &quot;language, country, variant&quot; but either variant or variant and
  79. country may be omitted. For more information please refer to documentation
  80. for the
  81. <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Locale.html">Locale</a>
  82. class.</td>
  83. <td align="center" valign="top">No</td>
  84. </tr>
  85. </table>
  86. <h3>Examples</h3>
  87. <pre>
  88. &lt;tstamp/&gt;
  89. </pre>
  90. <p>
  91. sets the standard <code>DSTAMP</code>, <code>TSTAMP</code>,
  92. and <code>TODAY</code> properties according to the default formats.</p>
  93. <pre>
  94. &lt;tstamp&gt;
  95. &lt;format property=&quot;TODAY_UK&quot; pattern=&quot;d-MMMM-yyyy&quot; locale=&quot;en&quot;/&gt;
  96. &lt;/tstamp&gt;
  97. </pre>
  98. <p>
  99. sets the standard properties as well as the property
  100. <code>TODAY_UK</code> with the date/time pattern &quot;d-MMMM-yyyy&quot;
  101. using English locale (eg. 21-May-2001).</p>
  102. <pre>
  103. &lt;tstamp&gt;
  104. &lt;format property=&quot;touch.time&quot; pattern=&quot;MM/dd/yyyy hh:mm aa&quot;
  105. offset=&quot;-5&quot; unit=&quot;hour&quot;/&gt;
  106. &lt;/tstamp&gt;
  107. </pre>
  108. <p>
  109. Creates a timestamp, in the property touch.time, 5 hours before the current time. The format in this example
  110. is suitable for use with the &lt;touch&gt; task</p>
  111. <hr>
  112. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights Reserved.</p>
  113. </body>
  114. </html>