开发者

Groovy date formatting problem

I am developing a groovy application and I am having problems when showing a Date fi开发者_运维百科eld.

If I use the following notation:

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

I am getting the actual date instead of what is saved at the DB.

When I use this notation it works properly.

<g:formatDate format="dd.MM.yyyy" date="${incidentTicketSLAInstance?.erstellungsDatum}" />

am I doing something wrong here? Are not both notations equivalent? (BTW, the instance DO exists and erstellungsDatum is NOT null)

Thanks in advance,

Luis


the fieldValue call will return a String, not a Date object, which the makes formatDate not work correctly

You have to use the second notation (as you spotted)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜