Yeah...that's what happens when you tweak sample code to demonstrate 
something...you always mix up something

With a unit="week" the offset should only be offset="1" (or maybe -1) for next 
week.

The confusion you got on the sample you wrote (the bizzare date of 19/15/2007) 
comes from the lowercase 'mm' you used in your pattern string....lowercase 'mm' 
is minutes, I believe you meant month which is uppercase MM

You will notice that your 'month' value (19) matches the minutes value 09:19 PM

Later,

Ninju
 


----- Original Message ----
From: Gilbert Rebhan <[EMAIL PROTECTED]>
To: Ant Users List <user@ant.apache.org>
Sent: Friday, April 27, 2007 3:33:59 PM
Subject: Re: How to set the next week start date


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 <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to