Re: Date calculation functions : Informix bug?
Posted in 1996
In article <54cs47$g1q@gulfa.kuwait.net>, Rudy Fernandes <rferdy@kuwait.net> wrote: > >Unfortunately it does not work. >e.g '31/10/96 + 1 UNITS MONTH' gives an error >(Form 1267 : The result of a datetime computation is out of range) >Informix seems to be trying to return 31/11/96 > >The same problem occurs with UNITS YEAR if a leap year is involved. > >I'm curious to know if this is a version 4.1 problem alone. > >Rudy Let us assume for a moment that 'adding/subtracting 1 month from a date' is a meaningful and well-defined operation. To what value should '31/10/96 + 1 UNITS MONTH' evaluate? I can see only three candidates: (1) '30/11/96' (2) '31/11/96' (3) '01/12/96' Let us reject (2) out of hand, as there is no such date. Given our assumption, we must surely agree that: '30/11/96 - 1 UNITS MONTH' = '30/10/96' (A) and '01/12/96 - 1 UNITS MONTH' = '01/11/96' (B) If (1) then we have '31/10/96 + 1 UNITS MONTH' - 1 UNITS MONTH = '30/10/96' by (A) If (3) then we have '31/10/96 + 1 UNITS MONTH' - 1 UNITS MONTH = '01/11/96' by (B) Unless we give up associativity - something I'd be loathe to do, to say the least - we would have to accept that either: 31/10/96 = 30/10/96 or that 31/10/96 = 01/11/96 By reductio ad adsurdum we must conclude that 'adding/subtracting 1 month from a date' is NOT a meaningful and well-defined operation. Therefore Informix is quite right to give you an error message! - Paul ************************************************************************* Disclaimer: All opinions expressed in this message are well-reasoned and insightful; needless to say, they are not those of Informix Software, its partners or lackeys. Anyone who says otherwise is itching for a fight.