O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required