How to display the Date and Time format in ADF page

In this post you will know how to display the DATE and TIME on the JSPX page.

If you want to display the DATE format in “DD-MON-YYYY ” and Time in “Hour:Min:Sec AM/PM do as below –

12 hour format

In View Object (VO), Under Attributes, for the DATE column, the hints should have “dd-MMM-yyyy hh:mm:ss a” value.

dd-MMM-yyyy is for Date

hh:mm:ss is for Time

a is for AM/PM

This displays the value in the JSPX page as 12-Jun-2011 04:45:24 PM.

24 hour format

In View Object (VO), Under Attributes, for the DATE column, the hints should have “dd-MMM-yyyy hh:mm:ss” value.

dd-MMM-yyyy is for Date

hh:mm:ss is for Time

This displays the value in the JSPX page as 12-Jun-2011 16:45:24.

The above method works fine to display the Date and Time even in the Table in JSPX page.

Note: The above will work fine when we want to display only in the jspx page. But if we want to insert into the table for this DATE column we need to convert the format as the sysdate which will be accepted by the table.

This entry was posted in ADF (Application Development Framework) and tagged , , , , , , . Bookmark the permalink.

4 Responses to How to display the Date and Time format in ADF page

  1. Mahesh says:

    Hi Udaya,

    Greetings.

    I have a requirement in my project saying I should have the date format in dd/mm/yyyy for my .jsff page. I checked the pre-defined format’s and did not find this. I also tried to change the existing format in the control hints of that field to my required format, but it throws String can’t be converted to Date exception. I actually need to display it in my page, so I don’t think writing any code would help me out. (Correct me if I am wrong) . Please let me know how to resolve that. Thanks.

    • udayarocks says:

      Hi Mahesh,
      I have solution to your problem. Please read below –
      To display the date in ‘dd/mm/yyyy’ format, edit the Control Hints for that field as “d/MM/yyyy”.
      Now the DATE field value will display as, for example: “24/12/2010”.

      Hope this helps to solve your requirement.

      Thanks,
      Udaya

      • Mahesh says:

        Thanks for the solution. It helps and I am able to match the requirement. However, I am also facing one more issue. I have a text field which should take 20 digits in numeric. The datatype for the field is oracle.jbo.domain.Number. When we are trying to enter the data and click on a button, it is turning the last 4 digits to 0. We tried to change the datatype to string whereever we are using the field (even in the bind variable), but still the problem persists. The datatype for the same field in database is Number. Please let me know how could we approach this issue. Let me also know if you need any more info on the issue. Thanks.

  2. pavan says:

    Hi Udaya
    I have a requirement , where the user enters a 10-digit number in a I/P text field in a form. It should be converted and shown in phone number format as : (123)-456-7890. Your help is appreciated.
    I am using Jdev 11.1.2.1.0

    Thanks

Leave a comment