Calendar selection goes 1 day in the past
Posted: 12 Mar 2010, 18:49
I am encountering a wierd problem where the date I submit through the Calendar control goes back one day when I display it in the subsequent page. So I select 12th March 2010, and the date passed to the backing bean becomes 11th March 2010.
All I have is the following:
and
In the form page I have:
and in the result page named selectedDate.xhtml I have:
I have also deployed the PrimeFaces showcase war file on my Glassfish v3 and the same problem also occurs. I select the date and submit, and the resultant date text becomes one day less than what I selected.
What could it be?
All I have is the following:
Code: Select all
@Stateless
@LocalBean
@Named
public class DateBean implements Serializable
{
private Date date;
public Date getDate()
{
return date;
}
public void setDate(Date date)
{
this.date = date;
}
}
Code: Select all
@Named
@SessionScoped
public class DateController implements Serializable
{
@EJB
private DateBean datebean;
public String processDate()
{
return "selectedDate";
}
}
Code: Select all
<h:form>
<p:calendar value="#{dateBean.date}" pattern="dd/MM/yyyy" />
<h:commandButton value="Set Date" action="#{dateController.processDate}" />
</h:form>
Code: Select all
The date you selected was:
<h:outputText value="#{dateBean.date}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
What could it be?