static { //注册日期字符到对象转换器 Converter dateConverter = new Converter() { @Override public Object convert(Class type, Object value) { try { return DateUtil.DATE_FORMAT2().parse((java.lang.String) value); } catch (ParseException e) { throw new RuntimeException(e); } } @Override public java.lang.String toString() { return "date for yyyy-MM-dd"; } }; System.out.println(BeanUtilsBean.getInstance().getConvertUtils().lookup(Date.class)); BeanUtilsBean.getInstance().getConvertUtils().register(dateConverter, Date.class); System.out.println("BeanUtilsBean.getInstance().getConvertUtils().lookup(Date.class):"+BeanUtilsBean.getInstance().getConvertUtils().lookup(Date.class)); }
spring 日期格式
猜你喜欢
转载自xinglijun1973.iteye.com/blog/2341986
今日推荐
周排行