ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckn...@onebox.com
Subject Adding a year to tstamp date
Date Fri, 09 Feb 2007 14:40:47 GMT
I have a need to set the value of a property to the current fiscal year. For this purpose,
that means that when running a build in October, November, or December, the value must be
the current year +1. In any other month, the value is the same as the current year.

I thought something like this would do the trick:
I set the value of ${MON} manually to "10" for testing purposes.

<property name="MON" value="10" />

<switch value="${MON}">
  <case value="10">
    <tstamp>
      <format property="current.fy" pattern="yyyy" offset="1" />
    </tstamp>
  </case>
  <case value="11">
    <tstamp>
      <format property="current.fy" pattern="yyyy" offset="1" />
    </tstamp>
  </case>
  <case value="12">
    <tstamp>
      <format property="current.fy" pattern="yyyy" offset="1" />
    </tstamp>
  </case>
  <default><property name="current.fy" value="${YEAR}" /></default>
</switch>

But the offset isn't applied. When I <echo>${current.fy}</echo> I get "2007".

Can someone offer me a solution to this?

Thanks.

-- 
Charles Knell
cknell@onebox.com - email

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


Mime
View raw message