thymeleaf中的日期格式转化

在制作项目中发现数据库中的datetime读取出来后显示出的时间不利于查看

于是在浏览多篇文章后,在这里总结一下

使用#dates.format来解决

<span th:text="${#dates.format(user.date, 'yyyy-MM-dd')}">4564546</span>     
或者是
<span th:text="${#dates.format(billingForm.startTime,'yyyy-MM-dd HH:mm:ss')}">4564546</span>

 

posted @ 2020-08-04 16:03  可达鸭给我冲鸭  阅读(1171)  评论(0编辑  收藏  举报