Reputation: 797
I'm using convertDataTime to convert dates from a database. The problem that arises is that does not display dates correctly:
Example: In the database I have the date 09/10/2013 14:36:57
and it displays 10/09/2013 13:36:57
.
Here is my code:
<p:dataTable ...>
...
<p:column headerText="Data of sale">
<h:outputText value="#{faturaVar.dataEmissao}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
</h:outputText>
</p:column>
...
</p:dataTable>
Att: I'm using primefaces 3.5, JPA / EJB.
Can anyone help?
Upvotes: 0
Views: 967
Reputation: 113
in your managed bean or cdi bean add a method like this
public TimeZone getTimeZone() {
return TimeZone.getDefault();
}
in the jsf ui <f:convertDateTime timeZone="#{bean.timeZone}" />
Upvotes: 0
Reputation: 9935
It is missing the timezone
attribute in f:convertDateTime
tag.
Update
There might be different timezone between DB Server
and Application Server
. Try to use timezone
attribute in f:convertDateTime
tag.
<f:convertDateTime pattern="dd/MM/yyyy hh:mm:ss" timezone="your-time-zone"/>
Upvotes: 1