bug in date function??
Posted in 2003
Topics: General Discussion
TO_CHAR(TO_DATE(TO_CHAR(odklon.datodk, "%0d%0m%Y"), "%0d%0m%Y")+6 UNITS MONTH, "%0d%0m%Y") AS DATE_FIN What is wrong with this statement. If datodk=31-05-1988 I get the following error: Error: The result of a datetime computation is out of range. (State:22008, Native Code: FFFFFB0D)
There's only 30 days in November 31-5-1988 + 6 months = 31/11/1988 > Mitja Udovc wrote: > > > > TO_CHAR(TO_DATE(TO_CHAR(odklon.datodk, "%0d%0m%Y"), "%0d%0m%Y")+6 > UNITS MONTH, "%0d%0m%Y") AS DATE_FIN > > What is wrong with this statement. If datodk=31-05-1988 I get the > following error: > > Error: The result of a datetime computation is out of range. > (State:22008, Native Code: FFFFFB0D) > > > > -- Paul Watson # Oninit Ltd # Growing old is mandatory Tel: +44 1436 672201 # Growing up is optional Fax: +44 1436 678693 # Mob: +44 7818 003457 # www.oninit.com #
On Mon, 22 Dec 2003 01:53:34 -0500, Mitja Udovc wrote: > TO_CHAR(TO_DATE(TO_CHAR(odklon.datodk, "%0d%0m%Y"), "%0d%0m%Y")+6 UNITS > MONTH, "%0d%0m%Y") AS DATE_FIN >What is wrong with this statement. If datodk=31-05-1988 I get the following > error: > Error: The result of a datetime computation > is out of range. (State:22008, Native Code: FFFFFB0D) PLEASE DO NOT POST HTML TO THIS LIST! THIS IS A TEXT ONLY NEWSGROUP. I think that Paul has hit it on the head. To calculate the last day of some month in the future/past. Calculate the first day of the following month and subtract one day. Art S. Kagel
"Art S. Kagel" <kagel@bloomberg.net> writes: > I think that Paul has hit it on the head. To calculate the last day of some > month in the future/past. Calculate the first day of the following month and > subtract one day. I've even posted the correct 4gl for this within the last several weeks to this group! Google is your friend!! -- Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412 Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142 President, CEO Fax: (760) 499-9152 My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084 4A88 8851 E6C8 69E3 B00B