Re: 4GL DateTime Variables
Posted in 1991
Path: emory!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!pyrnj!pyramid!infmx!news From: cortesi@informix.com (David Cortesi) Newsgroups: comp.databases.informix Message-ID: <1991Nov14.201343.15406@informix.com> Date: 14 Nov 91 20:13:43 GMT References: <20490001@hpspkla.spk.hp.com> Sender: news@informix.com (Usenet News) Reply-To: cortesi@informix.com Organization: Informix Software, Inc. In article <20490001@hpspkla.spk.hp.com> 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). Well, it isn't beautiful, but you could do something like... FUNCTION refmtdt(dt) DEFINE dt DATETIME YEAR TO FRACTION DEFINE mm, dd CHAR(2), yyyy CHAR(4), mmddyy CHAR(8) LET yyyy = EXTEND(dt, YEAR TO YEAR) LET mm = EXTEND(dt, MONTH TO MONTH) LET dd = EXTEND(dt, DAY TO DAY) LET mmddyy = mm,"/",dd,"/",yyyy[3,4] RETURN mmddyy END FUNCTION > My second question: I would like to calculate the difference in two dates > and then subtract out weekends and holidays from the result. I will leave this to better minds than mine...