Re: 4GL DateTime Variables
Posted in 1991
Path: emory!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!motcsd!starnet!pmahler From: pmahler@StarConn.com (Paul Mahler) Newsgroups: comp.databases.informix Message-ID: <1991Nov15.074048.16511@StarConn.com> Date: 15 Nov 91 07:40:48 GMT References: <20490001@hpspkla.spk.hp.com> Organization: Starnet-Public Access UNIX--Los Altos, CA 415-949-3133 engstrom@hpspkla.spk.hp.com (Kathleen Engstrom) writes: >Hi >I'm fairly new to the world of I4GL programming. I'm trying to format >some datetime variables. I was able to use expand to break it up and >get just the date portion of the variable, but I haven't found anything >that will allow me to format the result. (This is in a report) >I would like to put the date in a more human readable form. (i.e. 11/7/91 >instead of 91-11-7). One of the areas that 4gl really shines is in type conversion. Take the following program fragment: define tstamp datetime year to minute, c_tstamp char(30), pc_tstamp char(30) let tstamp = CURRENT let c_tstamp = tstamp let pc_tstamp = c_tstamp[1,4] This converts the timestamp to a character string. You can then use subscripting to pick the part of the string you are interested in. In the example, the substring selection pulls the year out of the timestamp. You can also format strings in the display statement with a "using" clause, for example display char_string using "###-###-###" >My second question: I would like to calculate the difference in two dates >and then subtract out weekends and holidays from the result. I would >appreciate any pointers, suggestions on how to do that cleanly. A turnkey >application would be even better :-) As far as I know, this would require some serious coding. I don't know of any way to discover weekends of holidays within a datetime or interval. >Thanks in advance >Kathleen -- -------------------------------------------------------------- Paul Mahler internet: pmahler@StarConn.com Consultant 1800 Market St. #257 voice: 415.327.6737