ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <...@schillbaer.de>
Subject Re: How to set the next week start date
Date Fri, 27 Apr 2007 19:33:59 GMT

Hi,

Ninju Bohra wrote:
> Have you looked at the <tstamp> task (http://ant.apache.org/manual/CoreTasks/tstamp.html)
> 
> Maybe something like:
> 
> <tstamp>
>       <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
>               offset="7" unit="week"/>
>   </tstamp>

i tried that on Win2000, with jdk 1.5.0_11 ant 1.6.5

<project name="project" default="main">
  <target name="depends">
    <tstamp>
      <format property="touch.time" pattern="mm/dd/yyyy hh:mm aa"
          offset="7" unit="week"/>
    </tstamp>
  </target>

  <target name="main" depends="depends">
	<echo>
       Antversion == ${ant.version}
       Today == ${TODAY}

       $${touch.time} == ${touch.time}
     </echo>
  </target>
</project>

and it gave me =

Buildfile: J:\eclipse_3_2\workspace\AntTest\tstamp.xml
depends:
main:
      [echo] Antversion == Apache Ant version 1.6.5 compiled on June 2 2005
      [echo] Today == April 27 2007
      [echo]
      [echo] ${touch.time} == 19/15/2007 09:19 PM
BUILD SUCCESSFUL
Total time: 156 milliseconds


hm, strange 19/15/2007 ??

i think you meant something like =

<tstamp>
	<format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
          offset="-7" unit="day"/>
</tstamp>

or

<tstamp>
	<format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
          offset="7" unit="day"/>
</tstamp>


similar to the example from manual :

   <tstamp>
       <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
               offset="-5" unit="hour"/>
   </tstamp>


but that gives him the actual date minus | plus 7 days.

 > Also when you say 'set the current date' what does that mean?
 > If you want to calculate what '7 days from now and set it to an ANT
 > property'
 >please look at the <tstamp> task otherwise please provide more 
 >explaination on what you need.

I thought the original poster was asking for

"...
the next weeks start date and last week start date
..."

because of that i suggested the <script> solution, where
he can choose, whether the start day of week = sunday or
monday.

Otherwise the </tstamp> would fit of course.

So he should provide some more details ;-)


Regards, Gilbert


> 
> ----- Original Message ----
> From: Satheesh <satish@ltp.soft.net>
> To: Ant Users List <user@ant.apache.org>
> Sent: Friday, April 27, 2007 4:51:12 AM
> Subject: How to set the next week start date
> 
> 
> Hi Guys, If i want to set the current date its possible in ANT , even if i want a date
which is some 'n' days after the current date, that also is possible..
> 
> I need a way to set the value of the next weeks start date and last week start date using
ANT.
> 
> How can i achieve this///



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message