Oracle Apex: Working with Date Picker

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.

This Post Has 10 Comments

  1. furqan

    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 ?

    1. Vinish Kapoor

      I have tested and it is showing the date and time as 28-Sep-2020 12:43AM. I can not see any issue.

    2. Ahmad

      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. Clark Pearson

    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

    1. Clark Pearson

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

  3. Krish

    Hi Vinish,
    How to highlight the selected date in calendar region as like todays date.

    Thanks,
    Krish

  4. Jonah R Giacalone

    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!
  5. Peter

    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

  6. Ashley Raber

    Vinish,

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

  7. Naley

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

Comments are closed.