web.xml:<context-param> <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name> <param-value>true</param-value> </context-param>
This way JSF will use the system's timezone as obtained by
TimeZone#getDefault() as converter's default timezone.Please note that the
java.util.Date object by itself also does not
store any timezone information. It also always defaults to UTC
timezone. Keep this in mind when processing submitted date/times.Optional:
<f:convertDateTime timeZone="#{yourBean.timeZome}" type="date" pattern="dd/MM/yyyy" />and in the back Bean (yourBean):
private TimeZone timeZone;
public TimeZone getTimeZome() {
timeZone = TimeZone.getDefault();
return timeZone;
}
Không có nhận xét nào:
Đăng nhận xét