日期:2014-05-20  浏览次数:20837 次

freemaker中有直接调用date类型数据的方法么?
还是用SSH框架,前台用freemaker遍历的一个数组list,代码如下:
<#list accountList as account>
<tr  
<td>${account_index+1}</td>
<td>${account.accNumber}</td>
<td>${account.name}</td>
<td>${account.createDate}</td><!--(date类型)-->
<td>${account.remark}</td>
<td>${account.currencyid}</td>
<td>${account.company}</td>

</tr>
</#list>
其中的createDate为date类型数据,但是遍历出来的是一个String,格式为2010-10-10,也没有什么年月日,很空,听他们说freemaker中有个调用date类型的方法,哪位大侠给说说咯,谢谢啦!

------解决方案--------------------
Java code
     FreeMarker支持date、time、datetime三种类型,这三种类型的值无法直接指定,通常需要借助字符串的date、time、datetime三个内建函数进行转换才可以
           <#assign test1 = "2009-01-22"?date("yyyy-MM-dd") />;
           <#assign test2 ="16:34:43"?time("HH:mm:ss") />
           <#assign test2 = "2009-01-22 17:23:45"?datetime("yyyy-MM-dd HH:mm:ss") />
           ${test1?string.full}

------解决方案--------------------
探讨
Java code
FreeMarker支持date、time、datetime三种类型,这三种类型的值无法直接指定,通常需要借助字符串的date、time、datetime三个内建函数进行转换才可以
<#assign test1 = "2009-01-22"?date("yyyy-MM-dd") />;
<#assign test2 =……