我是Java/Spring/Thymeleaf的新品牌,请耐心等待我目前的理解程度。我没有审查this similar question,但无法解决我的问题。在Thymeleaf中格式化日期
我想获得一个简化日期而不是长日期格式。
// DateTimeFormat annotation on the method that's calling the DB to get date.
@DateTimeFormat(pattern="dd-MMM-YYYY")
public Date getReleaseDate() {
return releaseDate;
}
// HTML
<table>
<tr th:each="sprint : ${sprints}">
<td th:text="${sprint.name}"></td>
<td th:text="${sprint.releaseDate}"></td>
</tr>
电流输出
sprint1 2016-10-04 14:10:42.183
我就离开这个位置:如果你是使用LocalDate或LocalDateTime在Thymeleaf中使用“temporals”而不是“dates” –