开发者

Groovy date formatting problem

开发者 https://www.devze.com 2022-12-11 07:48 出处:网络
I am developing a groovy application and I am having problems when showing a Date fi开发者_运维百科eld.

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

精彩评论

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