Re: Forms4.5: mm/dd/yyyy date format default

From: Ian C. Sellers <ian#_don't_need_no_stinking_spam_#_at_mystical.net>
Date: 1997/07/18
Message-ID: <33CFC64F.A1880287_at_mystical.net>#1/1


Be careful! I have heard of unexpected results from using mm/dd/rrrr. That mask itself is a contradiction. Even with mm/dd/rr, you must be careful with its 1st/2nd half-of-century logic.

What you really need to do is input the date in the same mask you use. If you give it mm/dd/yy as the mask, it will always default to current century. (you're right -- for some reason mm/dd/yyyy does not if only passed two year digits).

If you must provide flexibility of inputting either 2 or 4 year digits to user, try making a function with code (partially) as below to attempt different date formats. Concept is from Steven Feuerstein's Oracle PL/SQL book. The code shown below will even try to return a date from a six digit string.

This code works for my apps because we never need to enter a future date. Your needs may be different.

  BEGIN return_value := TO_DATE (value_int, 'MON-DD-YY');   EXCEPTION WHEN OTHERS THEN
  BEGIN return_value := TO_DATE (value_int, 'MON-DD-YYYY');   EXCEPTION WHEN OTHERS THEN
  BEGIN return_value := TO_DATE (SUBSTR(value_int,1,2) || '/' ||

            SUBSTR(value_int,3,2) || '/' ||
            SUBSTR(value_int,5,2), 'MM/DD/YY');
  EXCEPTION WHEN OTHERS THEN return_value := NULL;   END; END; END;
> Cathy Cantieri wrote:
> >
> > I put the format mm/dd/yyyy on an item and then when I enter 071697
 and move
> > off the field it is changing it to 07/16/0097. Why is it doing that?
 Why
> > doesn't it make the century 19? Is there a way to make it make the
 century the
> > current one?
>

Boris B. wrote:

> Try mm/dd/rrrr
Received on Fri Jul 18 1997 - 00:00:00 CEST

Original text of this message