You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Thomas Christen <ch...@active.ch> on 2001/01/02 13:28:00 UTC

AW: TStamp - custom formats

I'd greatly appreciate if my patch finally would be applied.

Regards
Thomas
> -----Ursprüngliche Nachricht-----
> Von: Rob Oxspring [mailto:roxspring@yahoo.com]
> Gesendet am: Samstag, 30. Dezember 2000 19:14
> An: ant-dev@jakarta.apache.org
> Betreff: Re: TStamp - custom formats
>
> The locale in the TODAY property is currently hard-coded to US but the
> pattern is also hard coded as "MMMM d yyyy" so I'm not sure why the locale
> is mentioned.  This could be changed to default to java's LONG US format,
> but I *think* that Java takes this information from the OS, and
> in Windows,,
> at least, you can change the long format to be whatever you choose.  I
> really don't want to break the default behaviour and so would
> like to avoid
> playing with the existing properties.  However maybe an alternative to
> specifying a pattern for a date property would be to specify [locale and]
> size attributes and let java handle the rest; does anybody want this?
>
> Concerning other tstamp patches:  I haven't been hanging around
> ant-dev for
> that long so sorry if i've reinvented the wheel.  I've just had a quick
> trawl through the ant-dev archives and have spotted the patch from Thomas
> Christen to allow fields with offset date/times, presumably this was the
> first patch?  I haven't been able to find any others, so what did
> the Scott
> Carlson one do? I'm quite happy to take the three patches away and merge
> them together, especially since I want to alter mine to stop it overriding
> existing properties anyway.
>
> Rob
> ----- Original Message -----
> From: "Marvin Greenberg" <MG...@Eidea.com>
> To: <an...@jakarta.apache.org>
> Sent: Friday, December 29, 2000 12:39 AM
> Subject: RE: TStamp - custom formats
>
>
> > Although this is useful in its own right, isn't the "correct" thing
> > to do to add an attribute to tstamp that changes the locale for the
> > TODAY variable or, better, use DateFormat in a way that respects the
> > locale? See DateFormat.getDateInstance(DateFormat.MEDIUM) and
> > DateFormat in general.
> >
> > Marvin
> >
> > -----Original Message-----
> > From: Diane Holt [mailto:holtdl@yahoo.com]
> > Sent: Thursday, December 28, 2000 7:01 PM
> > To: ant-dev@jakarta.apache.org
> > Subject: Re: TStamp - custom formats
> >
> >
> > Very cool. I'm already usin' it, and lovin' it.
> >
> > Nicely done! -- Hope it gets committed,
> > Diane
> >
> > --- Rob Oxspring <ro...@yahoo.com> wrote:
> > > I've just modified my copy of the Tstamp task, and thought others may
> > > want to use/commit it.  It adds the capability of creating properties
> > > with any format that the SimpleDateFormat class can handle.
> This means
> > > that we are no longer restricted to the US style (eg UK) and can add
> > > other stuff such as zimetone and era (should anybody have a
> need!). The
> > > default behaviour is unchanged, and the only downside is that it sets
> > > properties just as the rest of Tstamp does and does not tread
> carefully
> > > as the property task does - is this a problem?. The extended
> syntax is:
> > >
> > > <tstamp>
> > >     <property name="TODAY_UK" pattern="d MMMM yyyy">
> > > </tstamp>
> > >
> > > This will add a property TODAY_UK to the project with the value in the
> > > format: "28 December 2000"
> > >
> > > Hope its useful
> > >
> > > Rob
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
>


Re: TStamp - custom formats

Posted by Conor MacNeill <co...@cognet.com.au>.
Thomas,

Before I commit your patch, I'd like to understand the usefulness of it. As
I understand it, it seeks to add two new "hardcoded" properties, DSTAMP-1,
and TSTAMP-1 for yesterday's date and the last hour. I'm not sure exactly
why they are useful. If they are useful, why not add others like DSTAMP+1
for tomorrow or even one for last week or last month. I hope you can see
what I am getting at.

Do you think it would be desirable to allow a more general solution to this
requirement for offsets. Using Rob's updated approach, we could extend it
thus

<tstamp>
    <format property="TODAY_UK" pattern="d MMMM yyyy" offset="-1"
unit="day">
</tstamp>

While handling the units may be somewhat tedious, it is more flexible. You
could do something like

<tstamp>
    <format property="LicenceExpiryDate" pattern="dd/MM/yyyy" offset="7"
unit="day">
</tstamp>

to define a licence expiry date, for example. It also avoids adding further
implicit property names. Also the following

<tstamp>
    <format property="DSTAMP-1" pattern="yyyyMMdd" offset="-1" unit="day">
</tstamp>

would handle your needs, I think.

What do you think?

Sorry for the late feedback :-)

Conor


----- Original Message -----
From: "Thomas Christen" <ch...@active.ch>
To: <an...@jakarta.apache.org>
Sent: Tuesday, January 02, 2001 11:28 PM
Subject: AW: TStamp - custom formats


> I'd greatly appreciate if my patch finally would be applied.
>
> Regards
> Thomas
> > -----Ursprüngliche Nachricht-----
> > Von: Rob Oxspring [mailto:roxspring@yahoo.com]
> > Gesendet am: Samstag, 30. Dezember 2000 19:14
> > An: ant-dev@jakarta.apache.org
> > Betreff: Re: TStamp - custom formats
> >
> > The locale in the TODAY property is currently hard-coded to US but the
> > pattern is also hard coded as "MMMM d yyyy" so I'm not sure why the
locale
> > is mentioned.  This could be changed to default to java's LONG US
format,
> > but I *think* that Java takes this information from the OS, and
> > in Windows,,
> > at least, you can change the long format to be whatever you choose.  I
> > really don't want to break the default behaviour and so would
> > like to avoid
> > playing with the existing properties.  However maybe an alternative to
> > specifying a pattern for a date property would be to specify [locale
and]
> > size attributes and let java handle the rest; does anybody want this?
> >
> > Concerning other tstamp patches:  I haven't been hanging around
> > ant-dev for
> > that long so sorry if i've reinvented the wheel.  I've just had a quick
> > trawl through the ant-dev archives and have spotted the patch from
Thomas
> > Christen to allow fields with offset date/times, presumably this was
the
> > first patch?  I haven't been able to find any others, so what did
> > the Scott
> > Carlson one do? I'm quite happy to take the three patches away and
merge
> > them together, especially since I want to alter mine to stop it
overriding
> > existing properties anyway.
> >
> > Rob
> > ----- Original Message -----
> > From: "Marvin Greenberg" <MG...@Eidea.com>
> > To: <an...@jakarta.apache.org>
> > Sent: Friday, December 29, 2000 12:39 AM
> > Subject: RE: TStamp - custom formats
> >
> >
> > > Although this is useful in its own right, isn't the "correct" thing
> > > to do to add an attribute to tstamp that changes the locale for the
> > > TODAY variable or, better, use DateFormat in a way that respects the
> > > locale? See DateFormat.getDateInstance(DateFormat.MEDIUM) and
> > > DateFormat in general.
> > >
> > > Marvin
> > >
> > > -----Original Message-----
> > > From: Diane Holt [mailto:holtdl@yahoo.com]
> > > Sent: Thursday, December 28, 2000 7:01 PM
> > > To: ant-dev@jakarta.apache.org
> > > Subject: Re: TStamp - custom formats
> > >
> > >
> > > Very cool. I'm already usin' it, and lovin' it.
> > >
> > > Nicely done! -- Hope it gets committed,
> > > Diane
> > >
> > > --- Rob Oxspring <ro...@yahoo.com> wrote:
> > > > I've just modified my copy of the Tstamp task, and thought others
may
> > > > want to use/commit it.  It adds the capability of creating
properties
> > > > with any format that the SimpleDateFormat class can handle.
> > This means
> > > > that we are no longer restricted to the US style (eg UK) and can
add
> > > > other stuff such as zimetone and era (should anybody have a
> > need!). The
> > > > default behaviour is unchanged, and the only downside is that it
sets
> > > > properties just as the rest of Tstamp does and does not tread
> > carefully
> > > > as the property task does - is this a problem?. The extended
> > syntax is:
> > > >
> > > > <tstamp>
> > > >     <property name="TODAY_UK" pattern="d MMMM yyyy">
> > > > </tstamp>
> > > >
> > > > This will add a property TODAY_UK to the project with the value in
the
> > > > format: "28 December 2000"
> > > >
> > > > Hope its useful
> > > >
> > > > Rob
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Talk to your friends online with Yahoo! Messenger.
> > http://im.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: ant-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
>