Vote on date handling
Posted in 1993
In message <C5EEq3.7Az@promdist.pds.com> bill@promdist.pds.com (Bill Foote) writes: -> ->In article <1qc2m9INNcl0@emory.mathcs.emory.edu> ckipp@vth1.vth.colostate.edu (Cathy Kipp) writes: ->> ->>1) Many countries switched from Gregorian to Julian calendars on a ->> different date, so don't expect Informix to handle it. ->> ->>2) Adding or subtracting months from a date may produce en error ->> (eg. Jan 30 + 1 month). "The alternative would not be logical for ->> everybody" is the response. ->> ->>My response to both of these is: CHOOSE AN ALTERNATIVE and DOCUMENT IT! ->> ->> <...> ->>does anyone else have an opinion? -> ->Consider this a vote for Cathy's position... -> ->On number 1, though, I think that what Informix currently does is relatively ->reasonable (i.e. it just uses the Gregorian calendar throughout). ... omitted ... -> ->I think there's a much stronger case for #2... What's the point of being ->able to say "+ 1 month" if it blows up sometimes? That forces everybody ->to, once again, junk Informix's implementation and write their own. -> ... omitted ... I am going to vote on this one, too, so I hope that Informix is listening. (Note to Alan Denney and the other good folks at Informix who participate in this forum: I appreciate your feedback, but do you also flow our comments into the Informix input bin???) 1) I agree with Cathy: Choose an alternative and document it!!! One possibility: Since Informix is headquartered in an English-speaking country, default to the 1752 switch-over which was used in most such countries. Also, offer an environment variable (maybe named GREG1582) to provide the 1582 switch-over used by many countries that followed Pope Gregory's original edict. For those countries that switched at some idiosyncratic time, say "Sorry, unless you are willing to pay for development of a special version ..." 2) Here I must (partially) disagree with my friend Cathy: "+ 1 month" is a pretty darn vague concept. If it means "on the same day in the next month", then it should indeed have no meaning (i.e., produce an error) for "Jan 30 + 1 month". Probably the correct response is a **well documented** usage of WHENEVER ANY ERROR and the STATUS variable with DATETIME and INTERVAL arithmetic. My own feeling is that "Jan 31 + 1 month" is one instance of the "last day of the next month", which still needs to deal with leap years and so forth. Wow, didn't this whole thread start with Ruchi's question about the "number of days in the current month"? Now we have come full circle. Unfortunately, I *STILL* don't know what "Jan 30 + 1 month" means. How about "[date] + 31 days, but not past the last day of the next month"?? It is not graceful to say, but at least I know what that means! Regards, Alan +------------------------------+---------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, LSC | ( Please note: My opinions do not ) | | P.O. Box 179, M/S 5422 | ( represent official Martin policy. ) | | Denver, Colorado 80201-0179 | Voice: 303-977-9998 | +------------------------------+---------------------------------------+