toolbox.xml
<tool> <key>dateUtil</key> <scope>application</scope> <class>com.anxin.msapweb.util.DateUtil</class> </tool>
$!{dateUtil.getCurrDate_YYYY_MM_DD()}
日期函数
<tools> <toolbox scope="application"> <tool class="org.apache.velocity.tools.generic.DateTool" format="yyyy-MM-dd"/> </toolbox> </tools>
注:若不可以添加()
Example of formatting the "current" date:
$date -> Oct 19, 2003 9:54:50 PM
$date.long -> October 19, 2003 9:54:50 PM PDT
$date.medium_time -> 9:54:50 PM
$date.full_date -> Sunday, October 19, 2003
$date.get('default','short') -> Oct 19, 2003 9:54 PM
$date.get('yyyy-M-d H:m:s') -> 2003-10-19 21:54:50
Example of formatting an arbitrary date:
$myDate -> Tue Oct 07 03:14:50 PDT 2003
$date.format('medium',$myDate) -> Oct 7, 2003 3:14:50 AM