commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bingel, Michael" <Michael.Bin...@paybox.net>
Subject RE: [beanutils] How to convert from Date to (formatted) String ?
Date Tue, 13 May 2003 09:52:17 GMT

Okay, I know how to write a Converter, but how do I 
register it, when it should convert Date2String ?

Should it look like this ?

  ConvertUtils.register (new DateConverter(null), String.class);

Isn't it then called for every single String property, 
even if the source is not a Date ? How do I return so
that the default converter is invoked if I can't handle 
the conversion ?

cheers   Mike



> > I have a problem copying Dates to my struts form bean
> > and displaying them, because they are always converted
> > to the extended format "Wed Jan 01 00:00:00 CET 2003",
> > which I can not parse as input.
> >
> > Is it possible to create a DateToString Converter to
> > get a format like "yyyy-MM-dd HH:mm:ss" ?
> 
> yes.
> 
> > Will the BeanUtils.copyProperties() use the converter ?
> 
> so long as you register it, it will.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message