Re: DATETIME YEAR TO WEEK .....
Posted in 1999
Neil, The algorithm would be INT((day-of-year + 7 - offset)/7) where day-of-year is the number of elapsed days since the beginning of the year and offset is the number of days between the first of the year and the day of the beginning of the week. Usually Sunday, but you didn't say if your "week" begins on Sunday or not. I haven't tested this algorithm, but it looks right. :-) It should be easy to code in SQL or 4GL. Paul Storm > From owner-informix-list@iiug.org Tue Jun 1 15:49:10 1999 > From: "Neil Truby" <ntruby@netcomuk.co.uk> > To: informix-list@iiug.org > Subject: DATETIME YEAR TO WEEK ..... > Date: Tue, 1 Jun 1999 20:32:22 +0100 > X-List-Gateway: comp.databases.informix > > You can do this in Sybase, but I can't find any equivalent functionality in > Informix (obviously, it returns a week number in the range 1-53). > > Does anyone know if it can be done? > > thanks > > Neil > >