I have a form which inserts a date into a table. When primefaces calendar is used, the date is correct, but the time is added as well (in my case: 00:00:00.0)
here’s my form:
<h:form>
<h:messages/>
<h:inputText value="#{testBean.saveTabletest.first}"/><br/>
<p:inputMask value="#{testBean.saveTabletest.second}" mask="99999"/><br/>
<p:calendar id="testcal" value="#{testBean.saveTabletest.dates}" dateOnly="true" showOn="button"/><br/>
<p:commandButton value="Send" action="save"/>
</h:form>
And here is how the date is inserted in the database : 2012-10-03 00:00:00.0
I want the date inserted into the database without the time. The column in the table is a “date-column”
Is there a primefaces property that I can set to do this? or do I have to change the function that saves the data in the table (i am using hibernates saveOrupdate)?
Set the pattern attribute of p:calendar and declare the corresponding testBean member as Date.