Re: DATE and UNITS problem
Posted in 1995
On Feb 22, 11:24am, Alvin Koh wrote: > Subject: DATE and UNITS problem > I have a 4gl program that uses the DATE and UNITS as in > > main > define d1 date > define d2 date > let d1 = "1/31/1995" > let d2 = d1 + 1 units month > display d2 > end main > > The program fails because it trys to assign d2 a value of "2/31/1995" which > is of course an invalid date and results in the following error: > > Is this a known "bug" and what is the workaround? > > Thanks. Alvin, This is what is described as a feature and as far as I am aware this is the current ANSI standard specified behaviour. The problem lies in peoples differing interpretation on what +1 month means. Does it mean the last day of the next month what ever that is? Does it mean 28 or 29 or 30 or 31 days in the future depending on which month you are in or on the month you are going to be in? In this case some people might want it to become the first day of the following month? As there is no consensus on what it means the standard currently insists that the programmer makes his own decision and programs accordingly. I suspect that many people wanted additional syntax so that the programmer could specify this kind of choice to the engine and let the engine work it out based on the choice. I know I do. Unfortunately I don't have power over the ANSI committee and Informix tends not to add a lot of additional non standard syntax. A position I applaud in the long run as much as it makes me nash my teeth in the short run. -- ----------------------------------------------------------------------------- Jim Gordon DHL Airways Inc. jgordon@us.dhl.com ----------------------------------------------------------------------------- My opinions are my own. They may vary with time but they remain mine!