A Time/Hour Selector in ADF Faces - Did you know?

I must admit that I wasn't aware of this and I'm guessing that if this is news for me it might be news for other people so I wanted to blog about it.

Turns out that the af:inputDate components in ADF Faces can actually allow your customers to select a time(hour/minutes/seconds) as well as a date.

All you have to do to see it in action is give your ADF BC EO date field the type of Timestemp instead of Date, and possibly add a nice format mask under the UI hints like: yyyy-MM-dd HH:mm:ss
and you should get a calendar popup that looks like this:


While we are on the subject of date and time, I'll put another note here that the format mask that you use for an ADF BC date or timestemp format comes from the Java Date type.
Something like the table you can find here.


Hi Shay: Thanks a lot for this post. I have been looking for a time selector for a while and not able to find it in the docs before reading this. I have a question - i only need the time portion and not the date. Can this be done? Ideally the page itself will have the time portion of the popup. I will try editing the mask to see if it works just by doing that. Thanks, Raj

Posted by Rajbala Makar on December 10, 2009 at 03:12 AM PST #

Thanks for your post. Can you please tell who can we display date and time in view criteria? Thanks in advance. Regards Sameer

Posted by Sameer on May 29, 2011 at 09:11 PM PDT #

Sameer, if your viewCriteria has a bind variable and your attribute is set as a timestamp type, and the format is set to include hours then you'll see a time selector in your view criteria query component.

Posted by Shay on May 31, 2011 at 09:11 AM PDT #

Thanks for your reply Shay, i had tried this, but still now luck . Can you please give me any youtube link for the same. Once again thanks a lot for your reply.

Posted by Sameer on June 10, 2011 at 05:52 PM PDT #

Thanks a lot Shay, just after my last post i tried again and it worked. Thanks a lot !!!

Posted by Sameer on June 10, 2011 at 07:14 PM PDT #

Thanks for the post.
Is there any component in ADF, which only captures Time?

Posted by Chaitanya on July 19, 2011 at 03:45 AM PDT #

Chaitanya, I don't think there is a time only component - but I'm guessing you can just create two numberSpinners - one runs 0-23 and one 0-60 - and use the values from them to construct a time entry.

Posted by guest on July 19, 2011 at 03:48 AM PDT #

Hi Shay, we are not using BC4J in our project. Instead we are using EJB's for our backend. How can I make the af:inputDate component to show the time field as well in this case.

Posted by Rajesh on September 21, 2011 at 08:23 AM PDT #

Hi shay,
How to display only the time selector instead of both. I tried with <af:convertDateTime pattern="HH:MM:SS a"/>. Date field is showing in the same format OK fine. But in the pop up date and time both are coming exactly same as given above. I don't want to show the date selector in the pop up, needs to show only the time selector. could you please guide me.
Bijesh K

Posted by guest on November 13, 2011 at 04:44 AM PST #

We currently don't have a time selector only component.
I think it should be quite simple to create one for yourself - a dropdown list with 0-23 and an inputSpinner which run from 0-60.

Posted by guest on November 14, 2011 at 10:52 AM PST #

Nice post... Is it possible to disable the AM/PM radio and use 24-hour-day instead? In MyFaces Tomahawk there is an ampm attribute.


Posted by guest on March 05, 2012 at 09:11 AM PST #

guest - I haven't tried it but maybe you can use a 24 format for your date field k:mm:ss.

Posted by Shay on March 05, 2012 at 04:44 PM PST #

Perfect - the pattern k:mm:ss worked. Thanks a lot.

Posted by guest on March 06, 2012 at 12:19 AM PST #

Hi Shay, What about customizing the time part from the popup and only show the hour and minute number spinboxes, is this possible to achieve? Even if I set the format to 'dd-MMM-yyyy HH:mm', in the popup I still get the seconds number spinbox(is this a bug?)
Thanks, Georgiana

Posted by Georgiana on June 22, 2012 at 06:32 AM PDT #

Thanks ,
but what I'm searching about is how to view time only (Time picker).

Posted by Mohammad Alkhateeb on February 16, 2013 at 11:05 AM PST #

Mohammad - a time picker will probably just be a few down lists that you can implement on your own.

Posted by Shay on February 19, 2013 at 10:16 AM PST #

I need to set to the first second of the day.
For example:12/20/2013 00:00.
How can I do it?

Posted by guest on December 05, 2013 at 01:23 AM PST #

Hi guest,

I had the same use case and I used javascript and jQuery to hide the seconds spinbox from popup and to make the other(hour and minutes) spinboxes to point to 00:00


Posted by guest on December 05, 2013 at 11:33 AM PST #

A sample project demo would be nice :)

Posted by guest on April 16, 2014 at 08:43 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« June 2016