以下總結了使用Thymeleaf做項目過程中碰到的有價值的知識點。拿出來分享!
1.格式化日期
<span th:text="'發佈時間:'+${#dates.format(post.getPostTime(),'yyyy-MM-dd HH:mm')}">2019年05月12日 00:16</span>
<span th:text="'發佈時間:'+${#dates.format(post.getPostTime(),'yyyy-MM-dd HH:mm')}">2019年05月12日 00:16</span>