Groovy日期格式问题

时间:2009-11-16 11:49:10

标签: groovy date-format

我正在开发一个groovy应用程序,我在显示Date字段时遇到问题。

如果我使用以下表示法:

<g:formatDate format="dd.MM.yyyy" date="${fieldValue(bean: incidentTicketSLAInstance, field: "erstellungsDatum")}"/>                     

我得到的是实际日期,而不是数据库中保存的日期。

当我使用这种表示法时,它可以正常工作。

<g:formatDate format="dd.MM.yyyy" date="${incidentTicketSLAInstance?.erstellungsDatum}" />
我在这里做错了吗? 这两种符号都不相同吗? (顺便说一句,实例DO存在且erstellungsDatum不为空)

提前致谢,

路易斯

1 个答案:

答案 0 :(得分:1)

fieldValue调用将返回一个String,而不是Date对象,这使得formatDate无法正常工作

您必须使用第二种表示法(如您所见)

相关问题