X

Shay Shmeltzer's Oracle Development Tools Tips

  • November 20, 2009

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

Shay Shmeltzer
Director of Product Management - Oracle

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:

datetime.jpg

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.

Join the discussion

Comments ( 19 )
  • Rajbala Makar Thursday, December 10, 2009
    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
  • Sameer Monday, May 30, 2011
    Thanks for your post. Can you please tell who can we display date and time in view criteria?
    Thanks in advance.
    Regards
    Sameer
  • Shay Tuesday, May 31, 2011
    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.
  • Sameer Saturday, June 11, 2011
    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.
  • Sameer Saturday, June 11, 2011
    Thanks a lot Shay, just after my last post i tried again and it worked.
    Thanks a lot !!!
  • Chaitanya Tuesday, July 19, 2011

    Thanks for the post.

    Is there any component in ADF, which only captures Time?


  • guest Tuesday, July 19, 2011

    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.


  • Rajesh Wednesday, September 21, 2011

    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.


  • guest Sunday, November 13, 2011

    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.

    Regards

    Bijesh K


  • guest Monday, November 14, 2011

    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.


  • guest Monday, March 5, 2012

    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.

    Thanks


  • Shay Tuesday, March 6, 2012

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


  • guest Tuesday, March 6, 2012

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


  • Georgiana Friday, June 22, 2012

    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


  • Mohammad Alkhateeb Saturday, February 16, 2013

    Thanks ,

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

    Thanks


  • Shay Tuesday, February 19, 2013

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


  • guest Thursday, December 5, 2013

    I need to set to the first second of the day.

    For example:12/20/2013 00:00.

    How can I do it?


  • guest Thursday, December 5, 2013

    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

    Georgiana


  • guest Thursday, April 17, 2014

    A sample project demo would be nice :)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.