Re: 4GL DateTime Variables
Posted in 1991
Path: emory!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!pyrnj!pyramid!infmx!aland From: aland@informix.com (Colonel Panic) Newsgroups: comp.databases.informix Message-ID: <1991Nov16.225525.9408@informix.com> Date: 16 Nov 91 22:55:25 GMT References: <20490001@hpspkla.spk.hp.com> Sender: news@informix.com (Usenet News) Organization: International Brotherhood of Geeks, Local 619 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). Works for me: define x date, y datetime year to second, z char(10) let y = current let x = y let z = x using "mm/dd/yy" {in a report, you could say print x using "mm/dd/yy" or whatever format} >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 :-) Weekends aren't hard (see the weekday() function), but holidays are another story. The definition of "holiday" varies by entity (company, school, etc.) and by country. The best solution I've found is to keep a table of all holidays for upcoming year(s), or, if you have a date table already in some form, "mark" the holidays in a consistent manner. >Thanks in advance > >Kathleen -- Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland "Lee Harvey O. never had no daddy He never caught a break, he never drove a Caddy Joined the Marines to learn a skill Was (not Was) And that he did: he learned how to kill." "11 Miles Per Hour"