Re: Date Formats within Informix.
Posted in 1996
John Brownlee wrote: > > Morning everyone, > > We are using a format for a date of "DDMMMYYYY" in the form files of our > system. > I have tried unsuccessfully to use this Date format in the DBDATE > environment > variable, but it does not work, after talking to Informix Tech Support, > they said that > "DBDATE only supports numeric date types". > > Our company provides Software to both US and European Customers, and if we > could > use DBDATE or something similar to control this it would be very helpful. > The end result > that is required is something like the following :- > In US :- AUG061996 > In Europe :- 06AUG1996 > The below assumes that your basic assertation - DBDATE requires numeric-only format - which I haven't really proven to myself. Dates are stored in the database as numeric irregardless of the DBDATE setting. Your problem in primarially in presentation via 4GL (I assume the few people using DBACCESS to fetch, update, load, etc can get used to some all-numeric standard). So you could have a 4gl function that reads a user's environment variable to determine presentation: LET dtestring = set_dtestring() PRINT date_variable USING dtestring ... FUNCTION set_dtestring() DEFINE dtestring CHAR(9) IF fgl_getenv("CONTINENT") = "USA" THEN LET dtestring = "mmmddyyyy" ELSE LET dtestring = "ddmmmyyyy" END IF RETURN dtestring END FUNCTION I suppose you could get clever with $TZ instead of creating a new environment variable $CONTINENT There's a problem with forms that display dates - since FORMAT is hard-coded in the .per, you'll have to have two different .per files for each continent, or maybe define the date fields as CHAR, use USING to format in the 4GL before displaying, translate it somehow before storing into the database (mumble mumble left as an exercise to the developer). Sounds like a lot, but most can be boiled down to a couple generic functions calls, so if you invent it once you'll be ok. > Informix :- SE ENGINE 5.06 & 4GL 4.14 > > Any solutions, would be very helpful. > > Thanks in advance, > John Brownlee > > E-mail address :- 106005.3077@compuserve.com -- //////////////// ======================================================= ////////// // Dennis J. Pimple Informix Software, Inc. ////// / /// Principal Consultant 5299 DTC Blvd Suite 740 ///// // //// dennisp@informix.com Englewood CO 80111 //// // ///// /// // ////// recept: 303-850-0210 // // /////// direct: 303-740-5611 Opinions expressed are mine, / /////////// fax: 303-843-6408 and do not necessarily //////////////// http://www.informix.com reflect those of my employer