【发布时间】:2016-04-20 08:51:06
【问题描述】:
我知道我可以使用以下方法将 Spring MVC 表单 bean 绑定到 LocalDateTime:
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime startTime;
这会将2016-01-11T15:05:05.123Z 之类的字符串转换为LocalDateTime 对象。
我在这里找到了一些文档:http://blog.codeleak.pl/2014/06/spring-4-datetimeformat-with-java-8.html
我找不到如何对java.time.Duration 做同样的事情。我该怎么做?
【问题讨论】:
-
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)不是强制性的
标签: java spring-mvc jsr310