В моем приложении Spring Boot 2.
Моя модель:
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity
public class Category {
@Id
@GeneratedValue
private int id;
@NotNull
private String name;
private String description;
@NotNull
@DateTimeFormat(pattern = "dd.MM.yyyy HH:mm:ss")
private Date created;
@DateTimeFormat(pattern = "dd.MM.yyyy HH:mm:ss")
private Date updated;
здесь шаблон:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="${appName}">Category template title</title>
<link th:href="@{/public/style.css}" rel="stylesheet"/>
<meta charset="UTF-8"/>
</head>
<body>
<div class="container entity_list">
<h2>Categories</h2>
<br/>
<table>
<tr>
<th width="80">ID</th>
<th width="120">Name</th>
<th width="200">Created At</th>
<th width="200">Updated At</th>
<th width="60"></th>
<th width="60"></th>
</tr>
<th:block th:each="category : ${categoryList}">
<tr>
<td th:text="${category.id}"></td>
<td th:text="${category.name}"></td>
<td th:text="${category.created}"></td>
<td th:text="${category.updated}"></td>
<td><a th:href="@{/category/edit/{id}(id=${category.id})}">Edit</a></td>
<td><a th:href="@{/category/delete/{id}(id=${category.id})}">Delete</a></td>
</tr>
</th:block>
</table>
</div>
</body>
</html>
и здесь генерируется html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="/public/style.css" rel="stylesheet"/>
<meta charset="UTF-8"/>
</head>
<body>
<div class="container entity_list">
<h2>Categories</h2>
<br/>
<table>
<tr>
<th width="80">ID</th>
<th width="120">Name</th>
<th width="200">Created At</th>
<th width="200">Updated At</th>
<th width="60"></th>
<th width="60"></th>
</tr>
<tr>
<td>1</td>
<td>Toys</td>
<td>2020-01-08 14:44:30.035</td>
<td></td>
<td><a href="/category/edit/1">Edit</a></td>
<td><a href="/category/delete/1">Delete</a></td>
</tr>
<tr>
<td>2</td>
<td>Electronics</td>
<td>2020-01-08 14:44:30.136</td>
<td></td>
<td><a href="/category/edit/2">Edit</a></td>
<td><a href="/category/delete/2">Delete</a></td>
</tr>
<tr>
<td>3</td>
<td>Supermarket</td>
<td>2020-01-08 14:44:30.138</td>
<td></td>
<td><a href="/category/edit/3">Edit</a></td>
<td><a href="/category/delete/3">Delete</a></td>
</tr>
</table>
</div>
</body>
</html>
Как видите, даты не в формате дд.мм.гггг ЧЧ: мм: сс . Почему?