Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Mitja Udovc got a datetime out-of-range error adding 6 UNITS MONTH to 31-05-1988 via TO_CHAR/TO_DATE. Paul Watson explained the result would be 31 November, which does not exist. Art S. Kagel advised computing the first day of the following month and subtracting one day. Ronald Cole said he had posted 4GL for this before. Explained.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
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)
↪ replying to Mitja Udovc
Paul Watson — — source: Usenet: comp.databases.informix
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 #
↪ replying to Mitja Udovc
Art S. Kagel — — source: Usenet: comp.databases.informix
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
↪ replying to Art S. Kagel
Ronald Cole — — source: Usenet: comp.databases.informix
"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
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.