Reputation: 447
i have af:table which have af:coulmn which contain Date .
the date is displayed on the format of mm/dd/yyyy : 7/16/2018
i want to display at as yyyy/mm/dd 2018/7/16
<af:column sortProperty="depositeDate" sortable="false" width="10%"
headerText="#{bundle.deposite_Date_Label}">
<af:outputText value="#{row.depositeDate}"/>
</af:column>
how to achive that ?
Upvotes: 1
Views: 3252
Reputation: 2025
Inside the <af:outputText>
add the <af:convertDateTime>
tag, so your code should look like the following:
<af:column sortProperty="depositeDate" sortable="false" width="10%"
headerText="#{bundle.deposite_Date_Label}">
<af:outputText value="#{row.depositeDate}">
<af:convertDateTime pattern="yyyy/MM/dd" />
</af:outputText>
</af:column>
For reference about convertDateTime tag check this link.
PS: row.depositeDate needs to be a Date object, not a String!
Upvotes: 3
Reputation: 56
You could use DefaultDateFormatter
to achieve this:
DefaultDateFormatter ddf = new DefaultDateFormatter();
String depositeDate = ddf.format("yyyy/MM/dd, depositeDatePlain);
Upvotes: 1