commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sgarlata Matt" <sgarlata_m...@bah.com>
Subject Re: beanutils: how to convert string to date
Date Fri, 19 Sep 2003 18:41:22 GMT
Hi Vic, I might be missing something here but have you looked at this?

http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/package-summary.html#conversion.defining

I think the step you are missing is the call to the ConvertUtils.register()
method.

Matt
----- Original Message ----- 
From: "Vic Cekvenich" <cekvenich_vic@baseBeans.com>
To: <commons-user@jakarta.apache.org>
Sent: Friday, September 19, 2003 10:33 AM
Subject: beanutils: how to convert string to date


> I can write something like this:
> public java.sql.Date getSMaxDate() {
>      String _MaxDate = "1/1/1999";
> SimpleDateFormat df = new SimpleDateFormat("mm/dd/yyyy");
> java.util.Date du  = new java.util.Date();
> try {
>   du = df.parse(_MaxDate);
> } catch (Exception e) { log.error("Date conversion error " + _MaxDate +
> e);}
> java.sql.Date d= new java.sql.Date(du.getTime());
>
>
> return d;
> }
>
>
> But... is there a way to do
>
> Converter c = new SqlDateConverter();
> d = c.convert (_MaxDate, java.sql.Date.class  );
>
> I am looking at api and can;t figure how to use beanutils to make a
> string into a SQL date.
>
> Does someone have an example?
>
> tia,
> .V
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message