commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vic Cekvenich <cekvenich_...@baseBeans.com>
Subject beanutils: how to convert string to date
Date Fri, 19 Sep 2003 14:33:06 GMT
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


Mime
View raw message