これは私のデータモデルです。私はここから日付を使いたい。
私は私の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
しかし、私が投稿先頭の画像に、 あなたが見た。ティムメはそうではありません。 Canttのは、私が最初のピクチャ内のどの日付形式で表示さなぜ
これは、ドメイン内
public String getCreatedAtString() {
return createdAtString;
}
public TaskComment setCreatedAtString(String createdAtString) {
this.createdAtString = createdAtString;
return this;
}
private ZonedDateTime createdAt = ZonedDateTime.now();
のですか?
18/10/2016 13:51 w hat about this? – mark
'dd/MM/YYYY HH:mm'になります。そこに任意のパターンを使用できます。詳細はこちらをご覧ください:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html – DimaSan
org.thymeleaf.exceptions.TemplateProcessingException:例外の評価SpringEL式: "#dates.format(comment.createdAt、 'dd/MM/YYYY HH:mm')"(task_comment_cta:33) – mark