84487906 2013-07-11
我应用的是 smartgwt-3.1.jar
DateUtil 使用catalina.jar
字符段转换
Date date2 = DateUtil.parseInput("11/01/2011"); System.out.println(date2);
输出 Tue Nov 01 00:00:00 CST 2011
时间转换成字符
Date date1 =startDateItem.getValueAsDate(); String dateStr =DateUtil.formatAsShortDatetime(date1); System.out.println(dateStr);
输出:2013-07-04 06:00
DateUtil.setNormalDateDisplayFormatter(new DateDisplayFormatter() { public String format(Date date) { if(date == null) return null; final DateTimeFormat dateFormatter = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss"); String format = dateFormatter.format(date); return format; } }); dateStr =DateUtil.formatAsNormalDate(date1); System.out.println(dateStr);
输出: 2013-07-04 06:00:00