Re: entering datetime values
Posted in 1998
Jeff Larsen wrote: > Denise Wahl <wahl@uthscsa.edu> wrote: > > As far as I know, DATETIMEs are stored internally as > DECIMAL with the length being determined by the number > of fields specified. At least that's how it works in > ESQL/C. I am assuming the engine uses the same storage. > > For example, March, 1997 as DATETIME YEAR TO MONTH is > > 199703. > > while March 5, 1997 as DATETIME YEAR TO DAY is > > 19970305. > > So, if you want the user to be able to omit the day, your > program will have to add a default day. ... and there's no good way in 4GL to do this (unless you put up a full default Datetime). You'd have the same problem with DATE datatype, although DATETIME is admittedly more strict in input format (no FORMAT in .per allowed). Generally, I think my solution would be to have three seperate SMALLINT fields for Month, Year, and Day, which I would populate and format into a DATETIME programatically. That you could have more control over defaults for each parameter. And something else that might work that I though of as I type (not a good sign: this is all untested), is that you might be able to provide a function key to provide default date. So the user types in year & month then hits a function key. The program has an ON KEY clause that gets input (see get_fldbuf) currently in the field (I hope), appends the default day and DISPLAYs to the field. //////////////// ======================================================= ////////// // Dennis J. Pimple Informix Software, Inc. ////// / /// Principal Consultant 6300 S Syracuse Way Ste 205 ///// // //// dennisp@informix.com Englewood CO 80111 //// // ///// /// // ////// recept: 303-850-0210 // // /////// direct: 303-740-5611 Opinions expressed are mine, / /////////// fax: 303-779-4025 and do not necessarily //////////////// http://www.informix.com reflect those of my employer