Re: Programming in 4gl (Dates)
Posted in 1993
I dug up an article I remembered from back in 1990 which has some C functions explaining how to write code for a calendar for any dates between 1900 B.C. and 2900 A.D. inclusive. I would be happy to fax a copy to anyone interested... I don't plan on typing it in. Some interesting info though (which Informix doesn't take into account): "If you generate a calendar for the year 1582, Oct. 4 will be immediately followed by Oct. 15. This is not a bug; that year, the days Oct. 5 to Oct. 14 were canceled when the Julian calendar was replaced by the more accurate (and still used) Gregorian calendar. The functions in this article treat Oct. 4, 1582 and earlier dates as belonging to the Julian calendar, and Oct. 15, 1582 and later dates as belonging to the Gregorian calendar." For my uses, I have a simple function with a case statement which calculates the max day of the month given a month and a year (to account for leap year). I do however consider it a BAD Informix feature that if you add a month to, say March 31, that the correct reponse is an error (since April only has 30 days). This "feature" has caused me to write my own routines for adding/subtracting months to/from a date. Cathy +-------------------------------+----------------------------------------+ | Cathy Kipp | Internet: ckipp@vth1.vth.colostate.edu | | Veterinary Teaching Hospital | | | Colorado State University | Voice: (303) 491-1294 | | Fort Collins, CO 80523 | Fax: (303) 491-1205 | +-------------------------------+----------------------------------------+