<rich:column>
<f:facet name="header">
<h:outputText value="Expiry Date"/>
</f:facet>
<h:outputText value="#{item.endDate}">
</h:outputText>
</rich:column>
Using above code, I got the date from database is 2012-09-03 00:00:00.0
Now, I want to set the date pattern to dd-MM-yyyy.
So my required output is 03-09-2012.
But using below code (after setting the pattern)
<rich:column>
<f:facet name="header">
<h:outputText value="Expiry Date"/>
</f:facet>
<h:outputText value="#{item.endDate}">
<f:convertDateTime pattern="dd-MM-yyyy" />
</h:outputText>
</rich:column>
I am getting the output is 02-09-2012
Whatever date is in database, it shows output less by one day.
In advance thanks.
You should add suitable timeZone
attribute to convertDateTime
component.
For an example in my zone
<f:convertDateTime pattern="dd-MM-yyyy" timeZone="Asia/Calcutta" />
Note:
you can use java.util.TimeZone.getDefault().getID()
to get your current time zone id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With