Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 38780 invoked from network); 25 Nov 2002 22:12:55 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 25 Nov 2002 22:12:55 -0000 Received: (qmail 22605 invoked by uid 97); 25 Nov 2002 22:13:28 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 22488 invoked by uid 97); 25 Nov 2002 22:13:27 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 22227 invoked by uid 98); 25 Nov 2002 22:13:25 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <20021125221221.37364.qmail@web20417.mail.yahoo.com> Date: Mon, 25 Nov 2002 14:12:21 -0800 (PST) From: Matt Benson Subject: RE: converting date/time To: Ant Users List In-Reply-To: <20021113161545.48380.qmail@web20413.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Did anybody else have any opinions on whether the change I proposed in this thread would be valuable? -Matt --- Matt Benson wrote: > Again, what I was talking about was a less > date/time-centric approach: > > > > > 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): > > > > (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 > wrote: > > Yes that's what I'm looking for. something like > > this: > > > > > property="newdate" /> > > > > then ${newdate} = 2002-06-01 > > > > I supposed it would be better like this: > > > > property date = 0206 > > > 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:gudnabrsam@yahoo.com] > > > 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 > > > , 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 > > > 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 > > > > > > 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: > > > > > > > > > For additional commands, e-mail: > > > > > > > > > > > > > > > > > > __________________________________________________ > > > Do you Yahoo!? > > > U2 on LAUNCH - Exclusive greatest hits videos > > > http://launch.yahoo.com/u2 > > > > > > -- > > > To unsubscribe, e-mail: > > > > For additional commands, e-mail: > > > > > > -- > > To unsubscribe, e-mail: > > > > For additional commands, e-mail: > > > > > > > __________________________________________________ > Do you Yahoo!? > U2 on LAUNCH - Exclusive greatest hits videos > http://launch.yahoo.com/u2 > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus � Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: