Я новичок в 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, используйте «temporals» вместо «date» в Thymeleaf. –