全局日期处理、文件上传下载、参数绑定、restful请求
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
package com.heibaiying.convert;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : heibaiying
|
||||
* @description :
|
||||
*/
|
||||
public class CustomDateConverter implements Converter<String, Date> {
|
||||
|
||||
public Date convert(String s) {
|
||||
try {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return simpleDateFormat.parse(s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user