开发者

How to convert JSF date to MySQL date?

In JSF I am saving a date to database, b开发者_如何学运维ut in database the value is different. Everytime it is showing month as 01. I've already set the context parameter

javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE

to true, but it is still not working. In entity bean I am using java.util.Date to hold the date. I am using MySQL as database.


Apparently you're only taking year-month-day and you incorrectly used mm instead of MM to denote the month part in the <f:convertDateTime pattern> attribute. The mm stands for minutes, not months. You can find an overview of all valid patterns in the SimpleDateFormat javadoc.

That context parameter is totally unrelated to the months. It just tells JSF that it should use platform default time zone instead of UTC to use to interpret and represent the time part.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜