<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
<version>${thymeleaf-extras-java8time.version}</version>
</dependency>
首先我们需要引入上面的包,因java8中时间类型与之前版本不一致
在转换中应该采用temporals来做格式化
<td th:text="${#temporals.format(userRelation.updateTime,'yyyy-MM-dd HH:mm:ss')}"></td>

本文介绍如何在使用Thymeleaf模板引擎时,针对Java 8中的新型时间类进行正确格式化的方法。具体地,通过引入thymeleaf-extras-java8time依赖,并利用#temporals.format方法完成日期时间的展示。
3754

被折叠的 条评论
为什么被折叠?



