ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: How to set the next week start date
Date Mon, 30 Apr 2007 07:03:45 GMT
Seems like <tstamp unit=week ... />

assumes a week starts with monday, what if 
you want the week to start with sunday ?!

Is that influenced from the locale settings | user.language ?


-----Original Message-----
From: Rebhan, Gilbert [] 
Sent: Monday, April 30, 2007 8:49 AM
To: Ant Users List
Subject: RE: How to set the next week start date


-----Original Message-----
From: Ninju Bohra [] 
Sent: Monday, April 30, 2007 6:58 AM
To: Ant Users List
Subject: Re: How to set the next week start date

Yeah...that's what happens when you tweak sample code to demonstrate 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

Oops ;-)

you're right

so :

<script language="ruby">
        t =
        puts t.strftime("actual date == %m.%d.%Y")
        thisweek = (t - x * 86400).strftime("%m.%d.%Y")
        $project.setProperty "thisweek",  thisweek
        lastweek = (t - x * 86400 - 7 * 86400).strftime("%m.%d.%Y")
        $project.setProperty "lastweek",  lastweek

        nextweek =  (t - x * 86400 + 7 * 86400).strftime("%m.%d.%Y")
        $project.setProperty "nextweek",  nextweek

and :

    <format property="thisweek" pattern="MM.dd.yyyy"
       offset="0" unit="week"/>

    <format property="lastweek" pattern="MM.dd.yyyy"
       offset="-1" unit="week"/>

    <format property="nextweek" pattern="MM.dd.yyyy"
       offset="1" unit="week"/>

are giving the same result

Regards, Gilbert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message