Time for action – Calendar with the time picker options
Let us see how we can use the Calendar component as the date and time picker.
Create a Calendar component with time picker options using the pattern
attribute:
<p:calendar value="#{calendarController.meetingTime}" pattern="MM/dd/yyyy HH:mm:ss a" stepHour="2" stepMinute="5" stepSecond="10" minHour="9" maxHour="18"/>
What just happened?
We have used pattern="MM/dd/yyyy HH:mm:ss a"
, which makes the Calendar component display the time selection options. Here HH, mm, ss
and a
represents the hour, minutes, seconds and A.M./P.M. respectively. We have also used other options such as stepHour
and stepMinute
to specify the step value while dragging the sliders. Similar to the date range, we can also mention the time range using the minHour
, maxHour
, minMinute
, maxMinute
, minSecond
, and maxSecond
attributes. We can also use the Calendar...