Re: Informix date functions help
Posted in 2005
On Fri, 2005-12-02 at 13:07, asmath wrote: > I have a date table with date column in the Informix Database. I need > to have the Previous Month condition. > > If I run the report on Jan 1st 2006 or Jan 2nd or any date in the month > of Jan 2006 I should get Dec 2005 1 to 31 data in the report. I f I run > the report on Feb 1st the report should show Jan Data. > > > > The below condition helps to get the data for the previous month in > Oracle Database. I need the same kind of code in Informix. > > > > TRUNC(TIME_TAB.DAY,'MON') = TRUNC(ADD_MONTHS(SYSDATE,-1),'MON') > > > > TIME_TAB is the Time Table and DAY is the date column with date > datatype. extend(time_tab.day, year to month) = extend(today, year to month) - (1 units month) should do the trick. HTH, Carsten. sending to informix-list