Re: FORMS50: Date format question

From: Suresh Bhat <suresh.bhat_at_mitchell-energy.com>
Date: Fri, 09 Jul 1999 13:51:50 GMT
Message-ID: <01beca22$d7ff8aa0$a504fa80_at_mndnet>


Hi -

In Forms 3.0 the format that you are using will automatically convert 07101999 to 07/10/1999.

I cannot say about Oracle GUI forms but it should work the same way.

But the real problem is they could also enter 071099 and that gets converted to 07/10/0099.

This is the way we have taken care of this problem in forms. You can modify the procedure to use mm/dd/yyyy format or whatever.

          Stop the user from entering a 2 digit year in the form.

        Set the date format mask to dd-MON-yyyy in the form, and trap the error via the following procedure in the ON-VALIDATE-FIELD trigger for the date item in the form if they try to use a 2 digit year.

      	      procedure check_date_format(pl_date in date)
		 	is
      	      BEGIN
      	      /*  **************  Reference from LIBRARY LIB_GNRL 
*************  */
      	      /*
         	      Format mask DD-MON-YYYY on date field does not work
properly.
         	      For example, date entered as 15-OCT-93 changes to
15-OCT-0093
         	      rather than 15-OCT-1993.  This error is being trapped by
this
         	      procedure check_date_format and ON-VALIDATE-FIELD trigger
or
         	      KEY-NXTFLD trigger for the date field(s).

            	 	Input parameter     pl_date= date to be checked
      	      */
      	   		if substr(to_char(pl_date,'DD-MON-YYYY'),8,2) = '00' then
         	      		message('Date must be entered in DD-MON-YYYY format,
Example
                        		01-JAN-1993.');
         	      		raise form_trigger_failure;
[Quoted]       	   		end if;
      	   	END;

		In your ON-VALIDATE-FIELD trigger on the date item you simply need to
call this procedure:

                               check_date_format(:block1.date1);

Later !!!

Suresh Bhat
Oracleguru
www.oracleguru.net
oracleguru_at_mailcity.com

NEWS.M-L.NET <amiller_at_rhs.org> wrote in article <Rvah3.3$D47.202594_at_IConNet>...
> How are you handling input date field on the form?
>
> We have default date format on Oracle DB level and I have format mask for
> the date field as mm/dd/yyyy. It displays fine but I'm having hard time
for
> input.
>
> Users want to input 07101999 and Form to format as 07/10/1999 on the
form.
> I tried to use when-validate-record to manipulate date, also tried to use
> temp field to format the field but I was not successful.
>
> I'd appreciate if you could share your experience......
>
>
>
>
>
Received on Fri Jul 09 1999 - 15:51:50 CEST

Original text of this message