ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckn...@onebox.com
Subject RE: Re: Adding a year to tstamp date
Date Fri, 09 Feb 2007 15:25:31 GMT
Thanks, I just noticed the oversight of omitting the unit attribute.

I solved the issue this way.

<tstamp>
  <format property="YEAR" pattern="yyyy" />
  <format property="NEXT_YEAR" pattern="yyyy" offset="1" unit="year" />
</tstamp>

<switch value="${MON}">
  <case value="10"><property name="end.of.current.fy" value="30-SEP-${NEXT_YEAR}"
/></case>
  <case value="11"><property name="end.of.current.fy" value="30-SEP-${NEXT_YEAR}"
/></case>
  <case value="12"><property name="end.of.current.fy" value="30-SEP-${NEXT_YEAR}"
/></case>
  <default><property name="end.of.current.fy" value="30-SEP-${YEAR}" /></default>
</switch>
-- 
Charles Knell
cknell@onebox.com - email



-----Original Message-----
From:     Joel Klein <jfklein@wolfram.com>
Sent:     Fri, 09 Feb 2007 08:57:11 -0600
To:       Ant Users List <user@ant.apache.org>
Subject:  Re: Adding a year to tstamp date

cknell@onebox.com wrote:
>     <tstamp>
>       <format property="current.fy" pattern="yyyy" offset="1" />
>     </tstamp>
>   </case>
>
> But the offset isn't applied. When I <echo>${current.fy}</echo> I get "2007".
>
> Can someone offer me a solution to this?
>   
Looks like you can specify the units for offset, so try setting unit to 
"year".  The example from tstamp docs:

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

-- 
Joel Klein



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




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


Mime
View raw message