Re: help, "02/29/00" - invalid day in date?
Posted in 1995
>From: bp006c@uhura.cc.rochester.edu (Brian Sungjean Park)
>Date: Wed, 18 Oct 95 20:11:52 GMT
>X-Informix-List-Id: <news.18037>
>
> I'm experiencing a minor but annoying problem with Informix SE 4; I have
>a delimited input file which I'm loading into an Informix table like so:
>
> load from abc.unl
> insert into abc>
> Everything works fine, except there are a few DATE fields which have
>the value "02/29/00", that is, Feb. 29, 2000. This *is* a valid date,
>but Informix bombs out saying that I have an "invalid day in date".
No, it isn't a valid date -- 1900 was not a leap year.
The rule is simple; if it is a 2-digit year, 1900 is added to the year.
Because 00 is a 2-digit year, 1900 is added to it.
*** USE 4 DIGITS FOR THE YEAR ***
I'm not shouting at you in particular -- I'm shouting at anyone who reads
this who hasn't already got the message.
> I'm assuming that this is because of the leap-year thing; I've been
>looking over the books, but the most I can find is that "xx/xx/00" may
No, not 'may'; it *DOES* default to 1900.
>default to 1900, not 2000. This is in fact not important to me, because
>I am only displaying the date in "mm/dd/yy" format. Anyway, 2/29/1900
>was a leap-day, too.
No, 1900 wasn't a leap year!
Again, the rules are not all that hard. There is a leap year when the year
is evenly divisible by 400 (hence 2000 is a leap year); otherwise, if it is
evenly divisible by 100 it is not a leap year (hence 1900, 1800 and 2100,
etc are not leap years); otherwise, if it is divisible by 4 is is a leap
year (hence 1992, 1996, etc).
> I figure that there's not too much documentation on DATE because,
>yes, dates are supposed to be simple. Well, if anybody knows how I can
>remedy this problem, please help me out!
Use 4 digits for the year -- to enter 2000 into an Informix database, you
have to enter 2000.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>