i have a problem with a PrimeFaces component. I have the same code that is in the page http://www.primefaces.org/showcase/ui/input/calendar.xhtml I'm using the component that only shows the time. Here is mi code.
Time.xhtml
<h:form id="form">
<p:growl id="msgs" showDetail="true" />
<h:panelGrid columns="2" cellpadding="5">
<p:outputLabel for="time" value="Time:" />
<p:calendar id="time" value="#{calendarView.date11}" pattern="HH:mm a" timeOnly="true" />
</h:panelGrid>
<p:commandButton value="Submit" update="msgs" actionListener="#{calendarView.click}" icon="ui-icon-check" />
<p:dialog modal="true" resizable="false" header="Values" widgetVar="dlg" showEffect="fold">
<p:panelGrid id="display" columns="2" columnClasses="label,value">
<h:outputText value="Time:" />
<h:outputText value="#{calendarView.date11}">
<f:convertDateTime pattern="HH:mm a" />
</h:outputText>
</p:panelGrid>
</p:dialog>
</h:form>
And here is my bean.
CalendarView.java
private Date date11;
public void click() {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update("form:display");
requestContext.execute("PF('dlg').show()");
}
public Date getDate11() {
return date11;
}
public void setDate11(Date date11) {
this.date11 = date11;
}
The problem is when I run the Application, the calendar is addig six hours more.
It could be the Time Zone? How can I solved this?
java.util.Date
API but in this case, I cannot reproduce this problem on a blank playground project having only a single XHTML file. I also tried in a real application. Hours and minutes are displayed on a<p:dialog>
exactly as they are entered through a<p:calendar>
without setting thetimeZone
attribute associated with an<f:convertDateTime>
. – Tiny