16 February 2013

APEX: Using the Application Date Format Mask

In your APEX application, you can define several default format mask to be used throughout the application, such as the Application Date Format or the Application Date Time Format. This eliminates the need to specify the format mask for each Date Picker item that you use. It helps in keeping the application at least consistent regarding the format mask used.

When you want to do some validation in your forms using the Dates entered by the enduser, you might have a need for the Application Date Format.
So instead of hard coding (using the same format mask as you entered):
to_date (:P1_DATE_PICKER, 'dd-mm-yyyy')
write it using the built-in Application Date Format mask. Problem is.... the built-in for the Application Date Format Mask is not documented. Thanks to a prompt reply by Joel Kallman via Twitter, use the following built-in:
to_date (:P1_DATE_PICKER, :APP_NLS_DATE_FORMAT)