Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Joey Duhon — — source: Informix-list mailing list archive (1991-1998)
>>> date. This column needs to specify dates including the day in month.
>>> However, we wish to do a select on this column producing the last 6
>>> months rows to a specific day. Hence our select looks like:
>>>
>>> This should produce all rows within 6 months to the day.
>>> ^^^^^^^^^^
>>>
>>> What we want is the following results:
>>>
>>> (current date) (current-6 months)
>>> 1994-03-15 1993-09-15
>>> 1994-03-31 1993-09-30
>>>
>>> How can we achieve what we want with informix?
4gl function:
function
backmon(orig, num)
----------------------------------------------------------------------
define orig date
define num smallint
define newdate date
define mon datetime year to month
let mon = extend(orig, year to month) - num units month
let newdate = mon + 1 units month
let newdate = newdate - 1 units day
if day(orig) < day(newdate)
then let newdate = mon
let newdate = newdate + (day(orig)-1) units day
end if
return newdate
end function # backmon
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.