Did anybody else have any opinions on whether the change I proposed in this thread would be valuable?
-Matt --- Matt Benson <[EMAIL PROTECTED]> wrote: > Again, what I was talking about was a less > date/time-centric approach: > > <property name="dirname" location="DirName_0206" /> > > <property name="yymm" value="${dirname#DirName_}" /> > <property name="newdate" > value="20${yymm:0:2}-${yymm:2}-01" /> > > Here "${dirname#DirName_}" returns "0206" using > pattern matching: "If the pattern matches the > beginning of the variable's value, delete the > shortest > part that matches and return the rest." (O'Reilly, > Learning the bash Shell) This approach relies on > your > knowing that the prefix will be DirName. Or maybe > you > just know that the last four characters are yymm. > Then you could pull them off with a substring > operation (described in detail below): > > <property name="yymm" value="${dirname:-4}" /> > > (This negative offset is documented in the O'Reilly > bash book but it doesn't seem to work under either > Cygwin or the Solaris bash executable, but that > doesn't mean it couldn't be coded to work in Ant!) > > Either way, you the century "20" and day "01" are > (gasp) hard-coded, and the year and month are > separated by using string operations: > > "${yymm:0:2}" - substring pos 0 for 2 chars > "${yymm:2}" - substring pos 2 to end > > I feel like this would be fairly versatile. > > -Matt > > --- EXT / FOCAL MALAPRADE Roland > <[EMAIL PROTECTED]> wrote: > > Yes that's what I'm looking for. something like > > this: > > > > <datetime src="0206" format="yyMM" > > property="newdate" /> > > > > then ${newdate} = 2002-06-01 > > > > I supposed it would be better like this: > > > > property date = 0206 > > <datetime src="${date}01" format="yyMMdd" > > property="newdate" /> > > > > then ${newdate} = 2002-06-01 > > > > There doesn't seems to be anything like this in > Ant > > already, I'll probably > > have to code it myself > > > > Roland. > > > > > > > > > -----Message d'origine----- > > > De : Matt Benson [mailto:[EMAIL PROTECTED]] > > > Envoye : mercredi 13 novembre 2002 16:02 > > > A : Ant Users List > > > Objet : Re: converting date/time > > > > > > > > > Are you saying that, based on the directory name > > being > > > DirName_0206, you would know the corresponding > > date > > > would be 2002-06-01? If so, then it seems like > > some > > > simple String operations would do the trick... > > this > > > led me to think how cool it would be if the > > properties > > > syntax were expanded to include string and > pattern > > > operations a la bash (I don't know if all its > > string > > > operators are available in ksh or csh). > Probably > > it > > > wouldn't be difficult to code (if somebody tells > > me > > > where properties are parsed out of ${} syntax I > > might > > > look into it myself) and it could maybe make > life > > > easier in cases like this. > > > > > > Another related thing that might be cool is to > > have > > > either or both of: a way to limit the scope of > a > > > property, or a way to return a value from an > > > <antcall>, so that it might not be so "costly" > to > > use > > > properties for temporary values. > > > > > > Okay, so now everybody tell me I'm crazy and > argue > > > with me... :) > > > > > > -Matt > > > > > > > > > --- EXT / FOCAL MALAPRADE Roland > > > <[EMAIL PROTECTED]> wrote: > > > > I have a series of month-based directories in > > the > > > > format "DirName_yyMM". So > > > > for example: DirName_0206 is the directory for > > June > > > > 2002. > > > > > > > > In these directory, I need to replace dates in > > some > > > > files, but I need the > > > > date in the format yyyy-MM-dd, for example, > > > > "2002-06-01". > > > > > > > > Is there any task that can do this? like a > > <tstamp> > > > > where you could specify > > > > the date/time instead of the current > date/time. > > > > > > > > I suppose I could just write a task myself, > but > > if > > > > something like that > > > > already exists, it would make my life > easier... > > or > > > > lazier ;-) > > > > > > > > Thanks, > > > > Roland. > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > > > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands, e-mail: > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > __________________________________________________ > > > Do you Yahoo!? > > > U2 on LAUNCH - Exclusive greatest hits videos > > > http://launch.yahoo.com/u2 > > > > > > -- > > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > __________________________________________________ > Do you Yahoo!? > U2 on LAUNCH - Exclusive greatest hits videos > http://launch.yahoo.com/u2 > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus – Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>