Search code examples
oracle-databasedatepickeroracle-apex

Date Picker for years only - Oracle Apex v21.1


I was looking for a way to configure the Date Picker on Oracle Apex to only allow the users to select years

The default Date Picker looks like this

date picker

I would like to have something like this, when you click on the year to navigate faster between the dates :

date picker year only

I tried to switch on/off different settings on the Date Picker but nothing really changes, i always have the full date interface.

Also, my DATE column is a TIMESTAMP format, is there something to change here aswell ?

PS : I know that I could put a basic NUMBER(4) as a column for the date, but I'm not looking for this, I really only want the "year picker" thing.

Thank you in advance,

Thomas


Solution

  • That's actually easy to accomplish - if your Apex version supports it.

    I'm on 21.1 at the moment; here's a walkthrough:

    • create date picker item
    • navigate to its properites
    • for "Settings", disable "Use defaults" - new properties will appear
    • check the following checkboxes
      • month picker
      • year picker
    • run the page

    When you click the date picker button, calendar will open:

    • if you click the month name (at the top line), a new grid will open, showing 12 months in a year - that's what "month picker" does
    • if you click year (at the top line), a new grid will open, showing 12 years (that's what "year picker" does