Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I hope you know that most of the methods (and constructors) in the java.util.Date class are deprecated, so I suggest you to use the java.util.GregorianCalendar instead.</p> <p>Try this:</p> <pre><code>&lt;h:inputText value="#{myBean.meetingDate}"&gt; &lt;f:convertDateTime pattern="yyyy-MM-dd" /&gt; &lt;/h:inputText&gt; &lt;h:inputText value="#{myBean.meetingTime}"&gt; &lt;f:convertDateTime pattern="hh:mm:ss" /&gt; &lt;/h:inputText&gt; </code></pre> <p>Here's the backing bean:</p> <pre><code>import java.util.Date; import java.util.Calendar; import java.util.GregorianCalendar; public class MyBean { private GregorianCalendar fullMeetingDateTimeInfo = new GregorianCalendar(); private Date meetingDate; private Date meetingTime; public Date getMeetingDate() { return meetingDate; } public Date getMeetingTime() { return meetingTime; } public Date setMeetingDate(Date meetingDate) { this.meetingDate = meetingDate; fullMeetingDateTimeInfo.set(Calendar.YEAR, Integer.parseInt(new SimpleDateFormat("yyyy").format(meetingDate))); fullMeetingDateTimeInfo.set(Calendar.MONTH, Integer.parseInt(new SimpleDateFormat("MM").format(meetingDate))); fullMeetingDateTimeInfo.set(Calendar.DATE, Integer.parseInt(new SimpleDateFormat("dd").format(meetingDate))); } public Date setMeetingTime(Date meetingTime) { this.meetingTime = meetingTime; fullMeetingDateTimeInfo.set(Calendar.HOUR_OF_DAY, Integer.parseInt(new SimpleDateFormat("H").format(meetingTime))); fullMeetingDateTimeInfo.set(Calendar.MINUTE, Integer.parseInt(new SimpleDateFormat("mm").format(meetingTime))); fullMeetingDateTimeInfo.set(Calendar.SECOND, Integer.parseInt(new SimpleDateFormat("ss").format(meetingTime))); } public GregorianCalendar getFullMeetingDateTimeInfo() { return fullMeetingDateTimeInfo; } } </code></pre> <p>As you can see, I'm merging the date info from the one Date object with the time info from the other Date object. The merged data is stored in the <strong>fullMeetingDateTimeInfo</strong> property. So, in further you have to work with the <strong>fullMeetingDateTimeInfo</strong> property if you'd like to have the complete meeting-time info merged in one object.</p> <p>Good luck !</p> <p>Konstantin </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload