1 Star 0 Fork 0

LiShixi / pim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LocalDateAdapter.java 683 Bytes
一键复制 编辑 原始数据 按行查看 历史
LiShixi 提交于 2016-06-06 20:36 . jaxb
package jaxb;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
*
* @author LiShixi
*/
public class LocalDateAdapter extends XmlAdapter<String, LocalDate> {
@Override
public LocalDate unmarshal(String v) throws Exception {
return LocalDate.parse(v);
}
@Override
public String marshal(LocalDate v) throws Exception {
return DateTimeFormatter.ofPattern("yyyy MM-dd").format(v);
}
public static void main(String[] args) {
System.out.println(DateTimeFormatter.ofPattern("yyyy MM-dd").format(LocalDate.now()));
}
}
Java
1
https://gitee.com/loyy77/pim.git
git@gitee.com:loyy77/pim.git
loyy77
pim
pim
master

搜索帮助