Re: Q: Dates in Forms 3.0 / Oracle 7.2.2.4 / MMDDYYYY

From: Ken Johnson <ken.johnson_at_mail.tapestry.com>
Date: 1996/06/27
Message-ID: <31D356EB.60F3_at_mail.tapestry.com>#1/1


Gary Assa wrote:
>
> Dilema:
>
> In Forms 3, we want to have a date entry assume 19YY is only a 2 digit year
> is entered. In Oracle 6.0.34, we forced input format to MM/DD/YYYY and wrote
> a little routine that did this fine. However, in 7.2.2.3, it is turning
> , for example, 06/06/95 into 06/06/0095 and 060695 into 06/06/0095.
> Is there a routine, either built in, or custom written that will take care
> of my problem?
> I have tried writing something that turns a six or eight character entry
> (assuming MMDDYY or MM/DD/YY) into this format, but MM/DD/YYY is the same
> length as MMDDYYYY, so it fails.
>
> Is there a solution???
> --
> =========================================================
> http://www.li.net/~gsa/index.html
> This is my signature file, not part of this mail message.
> I point this out since some people are just plain stupid.

You could do something like this in the When-Validate-Item trigger: BEGIN

	IF (:block.datefield IS NOT NULL) THEN
		IF (TO_NUMBER(TO_CHAR(:block.datefield, 'yyyy')) BETWEEN 0 AND 100) THEN
			:block.datefield := TO_DATE(TO_CHAR(:block.datefield, 'mm/dd/yy'), 
'mm/dd/yy');
		END IF;
	END IF;

END; This should get oracle to assume the current century if none is specified
-- 
-------------------------------------------------
Ken Johnson -  Technical Consultant
Tapestry Computing, Inc. http://www.tapestry.com
Received on Thu Jun 27 1996 - 00:00:00 CEST

Original text of this message