Re: DATE and UNITS problem
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
In article <9502270712.AA23639@expo.lois.perm.su>, res@expo.lois.perm.su (Igor G. Popov) writes: |> > 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: |> |> > FORMS statement error number -1267. |> > The result of a datetime computation is out of range. |> |> > I am using ONLINE 5.01.UD2 and 4GL RDS 4.11.UC2. I have also got similar |> > results on ONLINE 5.03.UC1 and 4GL RDS 4.12.UE1. Has anyone encountered this? |> > Is this a known "bug" and what is the workaround? |> |> I have the same problem with RDS and CCV 4.10.UC3. I too have encountered the same problem and listed below is the workaround which I found satisfactory in calculating the expiration date for contracts. ***************************************************************************** #--------------------------------------------------------------------------- # date_calc - calculate the expiration date of the contract #--------------------------------------------------------------------------- function date_calc(fs_expire_dt,fs_init_term) define fs_expire_dt date, fs_init_term integer, fs_day integer, fs_month integer, fs_month2 integer, fs_year integer let fs_day = day(fs_expire_dt) let fs_month = month(fs_expire_dt) let fs_year = year(fs_expire_dt) let fs_expire_dt = mdy(fs_month,01,fs_year) let fs_expire_dt = fs_expire_dt + fs_init_term units month let fs_month2 = month(fs_expire_dt) let fs_expire_dt = fs_expire_dt + (fs_day - 1) while month(fs_expire_dt) != fs_month2 let fs_expire_dt = fs_expire_dt - 1 end while return fs_expire_dt end function -- =============================================================================== Gordy Bowar | email at: grb@alert.com | *** GO ROCKIES *** Denver, CO | voice at: (303) 488-7657 | *** GO TWINS *** ===============================================================================
Related threads
- Date-field - #months : 1267: The result of a datetime computation is out of range.
- Re: Leap Year
- Is this an informix leap year bug?