Search code examples
oracle-databaseoracle-apex

Oracle Apex - set value = dates


I have a page with a drop down P10_QUARTER_DD (submits page on selection), with year quarters like this:

Q1
Q2
Q3
Q4 

(display and return values are the same) This drop down sets the value of an item on change:

display_only_item_1

select
case
    when :P10_QUARTER_DD = 'Q1' then to_date('06/01/2022', 'MM/DD/YYYY') 
    when :P10_QUARTER_DD = 'Q2' then to_date('09/01/2022', 'MM/DD/YYYY') 
    when :P10_QUARTER_DD = 'Q3' then to_date('12/01/2022', 'MM/DD/YYYY')
    when :P10_QUARTER_DD = 'Q4' then to_date('03/01/2023', 'MM/DD/YYYY')
    else null
end quarter
from dual

When selecting (for example) Q2 I get the following value on my display item: 9/1/2022

Anybody knows how to fix this? how to get a proper date value? (I'll use this value for Interactive Report filtering)

Thanks


Solution

  • You should set the display only item's format mask attribute as MM/DD/YYYY. The query and the date format on your query, sets the items session value. How it is displayed on the page, can be set by format masking.