Informix SE DBCENTURY=C 1940->2040
Posted in 2001
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
following situation: DBCENTURY=C FRM Mask: ... [dtan______] (8 CHAR) ... dtan LIKE AMA.DTAN ...... "DD-MM-YY" 4gl Source: INPUT BY NAME gr_ama.* AFTER INPUT Field Input dtan : 10041940 after field input : gr_ama.DTAN = 10.04.1940 AFTER INPUT gr_ama.DTAN value change to 10.04.2040 with following corection it works ok: FRM Maske [dtan__________] (10 lang) .. dtan LIKE AMA.DTAN ...... "DD-MM-YYYY" is there an other way ? Thanks Peter
Peter Hrouda wrote: > > following situation: > > DBCENTURY=C > FRM Mask: > ... > [dtan______] (8 CHAR) > ... > dtan LIKE AMA.DTAN ...... "DD-MM-YY" > > 4gl Source: > > INPUT BY NAME gr_ama.* > > AFTER INPUT > Field Input dtan : 10041940 > after field input : gr_ama.DTAN = 10.04.1940 > > AFTER INPUT > gr_ama.DTAN value change to 10.04.2040 > > with following corection it works ok: > FRM Maske > [dtan__________] (10 lang) > .. > dtan LIKE AMA.DTAN ...... "DD-MM-YYYY" > > is there an other way ? > > Thanks Peter Prior to the turn of the century, I was preaching "always display 4 digits for the year part of a date", and now that the century has well and truly turned, I'm going to continue to say "always display all four digit for the year part of the date". And one of the reasons for doing so is precisely what you see. The reason it happens is that I4GL (or ISQL) takes the string you type (10041940) and displays the results as "10.04.40", and then it reinterprets what is displayed as a date, and under the DBCENTURY=C rules, "10.04.40" is the same as 2040-04-10. The only way to avoid this piece of misinterpretation is to ensure that all 4 digits of the year are displayed, hence the mantra: ALWAYS DISPLAY 4 DIGITS FOR THE YEAR PART OF A DATE -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"