日期:2014-05-19 浏览次数:20785 次
public class DateConvert implements Converter { @Override public Object convert(Class arg0, Object value) { if(value==null){ return value; } if(value instanceof Date){ return value; } Date d=null; if(value instanceof String){ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); try { d=sdf.parse(value.toString()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return d; } }