yah*_*ahh 2 jsf date primefaces
jsf 2 glassfish 4 primefaces 5.1
我正在使用f:convertDateTime转换显示日期的方式但显示错误的日期.当我通常显示它显示的日期时间为Jan Jan 01 00:00:00 AST 2011
这是正确的,但它不是我想要展示的
所以我正在使用<f:convertDateTime dateStyle="short"></f:convertDateTime>
但不是显示01/01/11它给我31/12/10
我试过使用,<f:convertDateTime pattern="MM/dd/yyyy"></f:convertDateTime>
但这也给了我12/31/2010而不是01/01/2011
<p:column headerText="Installation Date"
filterBy="#{w.installationDate}"
filterMatchMode="contains"
sortBy="#{w.installationDate}">
<h:outputText value="#{w.installationDate}" >
<f:convertDateTime pattern="MM/dd/yyyy"></f:convertDateTime>
</h:outputText>
</p:column>
Run Code Online (Sandbox Code Playgroud)
尝试将此添加到您的web.xml
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)