Oracle Apex: Working with Date Picker

In this tutorial, I will show you some useful property settings of Oracle Apex Date Picker item.

I am going to use the properties shown in the below image so that when I will give the reference below of any property you can see it in the image.

Oracle Apex: Date Picker settings.

1. Highlighting another Date with Current Date

In Oracle Apex date picker the current date is highlighted and focused by default, but if there is a requirement to highlight and set focus to a particular date, then use the following settings for the Highlighted Date property:

For example, highlight the date after the 7th day of the current date.

  • Highlighted Date: +7d

Output

Oracle Apex: highlight a date.

Today is the 4th April 2020, so after adding the 7 more days the date 11th April is also highlighted.

Similarly, if you want to highlight a day before the current date use hyphen (-), for example:

-7d to highlight a date 7 day before the current date.

The basic syntax of specifying the date values are:

(+/-)(n)(d/w/m/y)

Examples:

-1w or +1w to highlight the date before or after 1 week of the current date.

+2m to highlight and focus a date after two months of the current date.

Also, you can specify a page item having a valid date value to highlight the particular date. For example, &P18_HDATE.

2. Setting a Minimum and Maximum Date

The same rules apply to the Minimum and Maximum Date settings. The following are the examples:

Setting a minimum date to the current date and maximum date to 2 weeks later the current date.

  • Minimum Date: +0d
  • Maximum Date: +2w

Output

Oracle Apex: Setting a minimum and maximum date.

You can notice in the above image, that all other dates are disabled and only the current date with dates 2 weeks later is enabled.

For these Minimum and Maximum property settings, you can also specify the page item having the valid date value.

3. Display Drop Down for the Month and Year

To display the drop-down list for Month and Year to access it easily, set the following property:

  • Navigation List for: Month or (Month and Year)

4. Display the Hours and Minutes Drop Down

To display the hours and minutes drop-down in the date picker item use for Format Mask property to specify the time format:

  • Format Mask: MM/DD/YYYY HH24:MI:SS

Output

Oracle Apex: show time in date picker.

Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.

10 Comments

  1. I have datetime picker and format is set to DD-MON-YYYY HH:MIPM.Issue is it is showing 12AM or 12PM as 00 in the drop down of hours.Can I customize the drop down or any other solution ?

    • Is it possible to have today button only without having Hours, Minutes AP/PM displayed. I Used HH:MM:SS and it displays Hours, Minutes and Seconds.

  2. Hi Vinish,

    I want the highlighted date to be 'today'.

    I want to display 3 months, not just 1. (I know how to do this.)

    But I want the 2 months prior to this month, not the 2 months after.

    Is this possible?

    Thank you,
    Clark

    • Hi Vinish - do you know if it's possible to show earlier months with the date picker? (See earlier post.) Thanks.

  3. Two Oracle APEX questions.

    1. Regarding your Date Picker post, I don't see the "Show" option under Settings. I want to change it from On Click to On Focus. What version are you running?
    2. I want to set the min and max dates to a values obtained from a REST data source. Is that an option? Thanks!
  4. Hi Vinish,
    Is it possible to get a text ("Time") or an icon (Clock) in front of the selection boxes for hours and minutes ?
    Is there a template which formates the date picker box ?
    Thank you,
    Peter

  5. Vinish,

    I just wanted to thank you for your awesome post!! You are my team's go-to for APEX help!!

  6. Hi, how can make possible to see inside the datapicker the number of the week in the year?

Comments are closed.