thymeleaf 格式化时间


 

运用Thymeleaf模板后,前台的时间显示发生变化,和数据库不一致

HTML页面中格式如下:

<td th:text="${fleeceRecord.cashmereDate}"></td>
显示效果如下:

 

 

解决办法:Thymeleaf模板时间格式表达式     ${#dates.format(date, 'dd/MMM/yyyy HH:mm')}

<td th:text="${#dates.format(fleeceRecord.cashmereDate,'yyyy-MM-dd')}"></td>

如图

 

注释:如果只要年 如下:<td th:text="${#dates.format(fleeceRecord.cashmereDate,'yyyy')}"></td> 结果:2018

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM