Re: Gregorian Calendar switch
Posted in 1998
Graham Crookham (graham.crookham2@sbs.siemens.co.uk) wrote: : In the UK the switch to the Gregorian Calendar was in 1752 and the : changeover was complex. Unfortunately Informix doesn't understand this : at all and orders dates prior to this incorrectly as well as accepting : dates that did not exist (Half of september ws actually missing). : Is there any way of getting Informix to understand dates prior to 1752 : as being part of the Julian Calendar as used in Britain with year ends : in March. Absolutely! This kind of problem is precisely what Object-Relational DBMSs were designed to solve. Realisticly, there isn't sufficient demand for this kind of calender support to make it part of the server. However, you can simply extend the ORDBMS with your own definitions of 'date'. Here's how you do it. Start with an epoch. Might I suggest 7000 years before the year 2000 AD. This was 7000 years before 2000. For giggles, let's assume there are 365.26 days in a year[1]. This means that our epoch starts 2556820 days before 1st January 2000. Now for the tricky part. You need to write the functions to convert date representations to integers and back again. It's probably also a good idea to include, in your input and ouput routines, some specification of the calender you want. i.e. '12-12-1748 G', '12-12-1748 J', '12-12-1748 R' etc. Thus: YourDateInput('1-1-2000 G') -> 2556820 YourDateInput('31-12-1999 G') -> 2556819 YourDateInput('1-1-1900 G') -> 252029 YourDateOutput(252030) -> '2-1-1900 G' etc. You plainly know more about this problem than anyone else, so the specification of the algorithms shouldn't be too hard. If you can't write the code then hire a nice consultant to write it for you. (It feels like a fairly easy 2nd year computer science course problem in 'C'). NOTE: For those still worried about the 'high end' strategy IFMX is taking, this here is a 'high end' problem. [1] _Hammond_Internalional_Atlas_ Hammond Incorporated. 1993.