Ant时间戳的使用
用下面的源文件最好解释了:
<?xml version="1.0"?>
<project name="access" default="show" basedir=".">
<property file="ant.properties" />
<target name="default">
<tstamp/>
<!--以下的几个属性是系统自带的,初始了tstamp之后,它们就有值了-->
<echo message="System:"/>
<echo message="DSTAMP = ${DSTAMP}"/>
<echo message="TSTAMP = ${TSTAMP}"/>
<echo message="TODAY = ${TODAY}"/>
</target>
<!--下面设置我自己的日期时间格式-->
<tstamp prefix="my">
<format property="day" pattern="yyyy-MM-dd"/>
<format property="time" pattern="HH:mm:ss"/>
<format property="dt" pattern="yyyy-MM-dd HH:mm:ss.SSS"/>
</tstamp>
<target name="show">
<antcall target="default"/>
<echo message="-------------------------------------"/>
<echo message="Mine:"/>
<echo message="my.time = ${my.time}"/>
<echo message="my.day = ${my.day}"/>
<echo message="my.dt = ${my.dt}"/>
</target>
</project>
<project name="access" default="show" basedir=".">
<property file="ant.properties" />
<target name="default">
<tstamp/>
<!--以下的几个属性是系统自带的,初始了tstamp之后,它们就有值了-->
<echo message="System:"/>
<echo message="DSTAMP = ${DSTAMP}"/>
<echo message="TSTAMP = ${TSTAMP}"/>
<echo message="TODAY = ${TODAY}"/>
</target>
<!--下面设置我自己的日期时间格式-->
<tstamp prefix="my">
<format property="day" pattern="yyyy-MM-dd"/>
<format property="time" pattern="HH:mm:ss"/>
<format property="dt" pattern="yyyy-MM-dd HH:mm:ss.SSS"/>
</tstamp>
<target name="show">
<antcall target="default"/>
<echo message="-------------------------------------"/>
<echo message="Mine:"/>
<echo message="my.time = ${my.time}"/>
<echo message="my.day = ${my.day}"/>
<echo message="my.dt = ${my.dt}"/>
</target>
</project>
posted on 2008-12-30 13:49 CodingME! 阅读(5749) 评论(2) 编辑 收藏 举报