Re: DATE and UNITS problem
Posted in 1995
Alvin Koh writes: -> ->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: Well, it's not a bug, it's a feature. The problem is that there are several potentially correct answers to Jan 31, 1995 + 1 month: a) February 28, 1995 (matching end of month) b) March 3, 1995 (31 days) c) March 2, 1995 (someone who wants a 30 day month) c) Other (use your imagination) Informix has decided that they don't want to decide for the user what is correct, so they choose to have the program error out instead. The work around is to write your own routine for month addition/subtraction in order to take all the exceptions into account and return the answers you prefer. Regards, - Cathy -------------------------------------------------------------------------------- Cathy Kipp e-mail: ckipp@vth1.vth.colostate.edu Phone: (303) 491-1294 Colorado State University Veterinary Teaching Hospital Fax: (303) 491-1205