ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
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.country | user.language ?


Gilbert

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

Hi,
 

-----Original Message-----
From: Ninju Bohra [mailto:ninju_bohra@yahoo.com] 
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
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
*/

Oops ;-)

you're right


so :

<script language="ruby">
    <![CDATA[
        t = Time.now
        puts t.strftime("actual date == %m.%d.%Y")
        x=t.strftime("%w").to_i-1
       
        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
    ]]>
    </script>

and :

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

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

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


are giving the same result


Regards, Gilbert

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


Mime
View raw message