Re: Year 2000 rollover for date fields
Posted in 1996
>From: jregep@zenacomp.zenacomp.com (John Regep) >Date: 1 Apr 1996 16:50:22 -0500 >X-Informix-List-Id: <news.22695> > >Just a quick thought . > >Can't we just do some thing like : > >after field a_date_filed > let a_date = a_date + 100 unit years Yes, you can do it, and maybe it will work, but I wouldn't want to rely on it, and it isn't automatic -- it has to be coded by hand for every DATE field in every INPUT, INPUT ARRAY, or PROMPT statement. ugh! I think that you may run into problems with it because of the display processing logic if you re-enter a field. Suppose you enter a DATE field with a 2-digit value: 01/01/00 (for 1st January 2000). The value will be converted to 01/01/1900, and then post-processed by the AFTER FIELD block to 01/01/2000. If you then go back to the field, the value will be redisplayed as 01/01/00, and then reconverted via the AFTER FIELD block back to 01/01/2000. However, there is yet one more conversion which takes place, and that converts it to 01/01/1900, thus defeating all the good work that has gone before. You can see this with the attached code; I was testing with 6.01.UD1 P-code. You'd have to encode some logic in an AFTER INPUT block too, at least. That works in the test code, but adds an extra dimension to the complexity. No, I think you are not going to find it easy to debug and verify the code which uses 2-digits in the display of years -- you really need to upgrade to display 4-digit years! Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> -- form2000.per -- DATABASE FORMONLY SCREEN { [f001 ] [f002 ] } END ATTRIBUTES f001 = FORMONLY.d1 TYPE DATE, FORMAT = "dd/mm/yy"; f002 = FORMONLY.d2 TYPE DATE, FORMAT = "dd mmm yyyy"; END -- form2000.4gl -- MAIN DEFINE d1 DATE DEFINE d2 DATE OPEN FORM f_form2000 FROM "form2000" DISPLAY FORM f_form2000 OPTIONS INPUT WRAP INPUT d1 FROM formonly.d1 AFTER FIELD d1 LET d1 = d1 + 100 units year LET d2 = d1 DISPLAY d2 TO formonly.d2 AFTER INPUT LET d1 = d1 + 100 units year END INPUT CLOSE FORM f_form2000 DISPLAY d1 USING "dd mmm yyyy" DISPLAY d2 USING "dd mmm yyyy" END MAIN >Jonathan Leffler (johnl@informix.com) wrote: >: There is no way to do what you seek to do. > >: The 7.20 ESQL/C library uses the DBCENTURY environment variable >: to allow users to control way 2-digit years are mapped to 4-digit >: years. No release of I4GL using the 7.20 ESQL/C (or later) is planned. >: You will have to enter and display 4-digit years. > >: See also recent discussions of the subject on c.d.i. > >: Yours, >: Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> > >: }From: watjep@ns.netxpress.com (Paul K. Watje) >: }Date: Wed, 20 Mar 1996 20:31:39 GMT >: }X-Informix-List-Id: <news.22430> >: } >: }Does anyone know how to enter a 2000+ year on a 4GL perform screen >: }when a 2 digit year format is used? The date fields that use a 2 >: }digit year(MM/DD/YY) format will not allow you to enter a 2000+ year >: }entry. The year will be 1900 if you enter 01/01/00 on a date field. >: }You can enter a 4 digit year with a MM/DD/YYYY format.