问题:
jsf 中日期输出与数据库中不一致,差几个小时,确定是时区问题
|
<h:outputText value="#{row.msg.date}"> <f:convertDateTime pattern="HH:mm" /> </h:outputText> |
解决:
参考: http://stackoverflow.com/questions/7490954/set-a-default-time-zone-for-fconvertdatetime
- 设置 f:convertDateTime timeZone=”GMT+8″
- 或者设置jsf app级别的时区
|
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" ...> ... <context-param> <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name> <param-value>true</param-value> </context-param> .... </web-app> |