I'm working on an ant script. In this particular part, I need to get the current month, as well as the prior month. I was thinking something similar to
<tstamp>
<format property="thismonth" pattern="MMyy"/> <!-- 0210 by february 2010-->
</tstamp>
<!--I'd like to get 0110 (january 2010) here, but can't imagine how-->
<property name="priormonth" value="?">
I've been reading on property helpers, but I cant get what I need. Any ideas?
Thanks in advance.
ANT's tstamp task has an offset element:
This returns me a timestamp for two days ago. I would expect you'd be able to do the same thing if your pattern is months, then the offset would probably work in months.
Actually you can use:
So for 2 prior months you use:
You can do it with a custom JavaScript scriptdef:
I'm sure some regex can do wonder but I would simply create a custom Task.
Within your task, you can define a new property with the
getProjet().setProperty()
method.Something like the following should suffice:
What's left to do is to define a properties file with a link to the class:
When you load the task (see the Ant documentation), you just have to invoke your task with: