时间转换工具
来源:互联网 发布:mac xtrafinder 编辑:程序博客网 时间:2024/04/28 23:46
package cn.tarena.ht.controller;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
public abstract class BaseController {
@InitBinder
//此方法用于日期的转换,如果未加,当页面日期格式转换错误,将报400错误,实际是因为此方法
public void initBinder(WebDataBinder binder) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
public abstract class BaseController {
@InitBinder
//此方法用于日期的转换,如果未加,当页面日期格式转换错误,将报400错误,实际是因为此方法
public void initBinder(WebDataBinder binder) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
阅读全文
0 0
- JSON时间转换工具
- dmesg时间转换工具
- 时间转换工具类
- 时间转换工具
- dmesg时间转换工具
- 时间转换工具类
- 时间转换工具类
- unix时间戳 工具转换
- Android 时间转换工具类
- 时间戳转换在线工具
- Android工具类(时间转换)
- 时间转换处理工具类
- Android时间转换工具Time
- JAVASCRIPT时间戳转换工具
- android 时间转换工具类
- DateUtil时间转换工具类
- 3.时间转换工具类
- 时间转换工具/时间和13位毫秒转换软件
- Wifi知识点
- linux服务器端口查看的方法
- Keras基于TensorFlow实现的简单分类问题
- 认识传感器
- Java学习笔记-二叉树的遍历
- 时间转换工具
- #pragma once 与 #ifndef 解析
- 蓝牙
- 网络状态的判断
- Oracle中用exp/imp命令参数详解
- Proe 5.0 的安装及相关问题
- Android ListView 异步加载图片错位的问题
- 面试经验分享
- 10.3作业