赞
踩
- /**
- * 全局日期处理
- */
- public class StringToDateConverter implements Converter<String, LocalDateTime> {
-
- //private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
- //private static final String shortDateFormat = "yyyy-MM-dd";
-
- @Override
- public LocalDateTime convert(String value) {
-
- if(StringUtils.isEmpty(value)) {
- return null;
- }
- try {
- return LocalDateTime.parse(value.trim());
- } catch (Exception e) {
- throw new RuntimeException(String.format("parser %s to Date fail", value));
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。