I am trying to display the date from my DB (which is mysql). And it shows all the dates correctly except one date. When displaying the last day of the year (31st December), the day and month values are correct but the year value shows the next year.
This is my code:
<h:outputText value="#{bean.date}" >
<f:convertDateTime pattern="dd/MM/YYYY"/>
</h:outputText>
And in my web.xml
file I have this code:
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
For 31/12/2013, it shows 31/12/2014 and this is the same for all years.
How can I solve this?
Thanks.
As per the javadoc, the correct pattern for year is yyyy
, not YYYY
. With YYYY
, the year in which the week falls would be used instead. 30 and 31 december 2013 participate in week 1 of year 2014.
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