Velocity日期格式化

1、pom.xml添加依赖

<dependency>
<groupId>velocity-tools</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.4</version>
</dependency>

2、页面处理程序加入如下语句:

import org.apache.velocity.tools.generic.DateTool;
context.put("date", new DateTool());
//SpringMVC中这样写
modelAndView.addObject("date", new DateTool());

3.页面模板中这样写:

$!date.format('yyyy-MM-dd HH:mm:ss',$!articleDetail.publicTime)
上一篇:OpenCV(3.4.1) Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window.cpp, line 356


下一篇:echarts中显示效果option中必有的属性