thymeleaf + spring date conversion
Это моя модель. Я хочу использовать дату отсюда.
Я делаю это в моем HTML:
<table th:if="${!commentsInTask.empty}">
<tbody>
<tr th:each="Comments : ${commentsInTask}">
<tr th:each="comment : ${Comments}">
<td th:text="${comment.user}">user ...</td>
<td th:text="${comment.createdAt}">date ...</td>
</tr>
</tr>
</tbody>
</table>
но она приносит:
<table>
<tbody>
<td>JACK</td>
<td>1.476787930289E9</td>
</tr>
</tr>
</tbody>
</table>
Эта часть Unix timedate: 1.476787930289E9
но на картинке в начале я отправил , Вы видели. Тимме не так.
Это в домене
public String getCreatedAtString() {
return createdAtString;
}
public TaskComment setCreatedAtString(String createdAtString) {
this.createdAtString = createdAtString;
return this;
}
private ZonedDateTime createdAt = ZonedDateTime.now();
Почему Cantt я вижу в формате даты, которые в картинке в начале?
18/10/2016 13:51 w hat об этом? – mark
Это будет 'dd/MM/YYYY HH: mm'. Вы можете использовать любой шаблон там, пожалуйста, ищите дополнительную информацию здесь: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html – DimaSan
org.thymeleaf.exceptions.TemplateProcessingException: Исключение оценки Выражение SpringEL: «# date.format (comment.createdAt, 'dd/MM/YYYY HH: mm')" (task_comment_cta: 33) – mark