SimpleDateFormat sm = new SimpleDateFormat("2008年5月12日 10:40:39"); System.out.println(sm.format(new Date()));
//发错 SimpleDateFormat sm = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss"); System.out.println(sm.format(new Date()));
我用 <fmt:formatDate value="${order.getOrderdate()}" var="orderDateTime" type="both" pattern="yyyy年MM月dd日 hh:mm:ss"/> <td height="26"> 日期:${orderDateTime} </td>报错 :Unable to convert string "${order.getOrderdate()}" to class "java.util.Date" for attribute "value": Property Editor not registered with the PropertyEditorManager 是怎么回事???????
SimpleDateFormat sm = new SimpleDateFormat("2008年5月12日 10:40:39");
System.out.println(sm.format(new Date()));
//发错
SimpleDateFormat sm = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
System.out.println(sm.format(new Date()));
<td height="26"> 日期:${orderDateTime} </td>报错
:Unable to convert string "${order.getOrderdate()}" to class "java.util.Date" for attribute "value": Property Editor not registered with the PropertyEditorManager
是怎么回事???????
order.setOrderdate(new Date());
orderservice.addOrder(order);
而数据库字段类型为Date,所以只有在页面转换,而不能在action中呀
String month = "" + (calendar.get(GregorianCalendar.MONTH) + 1);
if (month.length() == 1) {
month = "0" + month;
}
String day = "" + calendar.get(GregorianCalendar.DAY_OF_MONTH);
if (day.length() == 1) {
day = "0" + day;
}
String hour = "" + calendar.get(GregorianCalendar.HOUR_OF_DAY);
if (hour.length() == 1) {
hour = "0" + hour;
}
String minute = "" + calendar.get(GregorianCalendar.MINUTE);
if (minute.length() == 1) {
minute = "0" + minute;
}
String second = "" + calendar.get(GregorianCalendar.SECOND); if (second.length() == 1) {
second = "0" + second;
}
String str = year + "年" + month + "月" + day + "日 " + hour + ":" +
minute + ":" + second;