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

HTML页面中格式如下:

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

 thymeleaf 格式化时间

 

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

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

如图

thymeleaf 格式化时间

 

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

 

相关文章:

  • 2021-09-28
  • 2021-06-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
  • 2022-01-09
  • 2021-07-15
  • 2022-12-23
相关资源
相似解决方案