velocity (vm模板)时间显示 时间格式化 时间转化

来源:互联网 发布:ubuntu查看用户密码 编辑:程序博客网 时间:2024/05/27 01:13
具体修改步骤:
1、在toolbox.xml配置文件中添加以下代码:
<tool>
<key>date</key>
<scope>application</scope>
<class>org.apache.velocity.tools.generic.DateTool</class>
</tool>
2、在前台页面中需要显示时间的地方添加这样的代码:
例如:要显示的时间为:$!user.time
那么添加的代码为:
$!date.format('yyyy-MM-dd HH:mm:ss ',$!user.time)
其中'yyyy-MM-dd HH:mm:ss '格式可以自己定义。
0 0
原创粉丝点击