Leap year issue

Geeks can be unpredictable and no wonder we had the y2k issue. Recently I came across a similar if not minor situation with the dates in Oracle database. Here is the scenario, you need to compare transaction date with the system date of birth but the catch is that you need to make sure that they are 12 years or older. Remember there is no date of birth passed on from the front end. So the easiest way they figured was to get the date extract only the year for e.g 29-Feb-2008 you extract the year 2008 and subtract the 18 years and you end up with 1990 and then add the date which in this case would be 29-Feb-1990 and convert it to a date and compare it against the date of Birth and off you go. Well it was fine until today when Oracle tried to convert the date it failed and you have errors all over the place. But this was the easiest thing to do and they did it. Now they can have another four years to fix it.

Comments are closed.

Leap year issue

Geeks can be unpredictable and no wonder we had the y2k issue. Recently I came across a similar if not minor situation with the dates in Oracle database. Here is the scenario, you need to compare transaction date with the system date of birth but the catch is that you need to make sure that they are 12 years or older. Remember there is no date of birth passed on from the front end. So the easiest way they figured was to get the date extract only the year for e.g 29-Feb-2008 you extract the year 2008 and subtract the 18 years and you end up with 1990 and then add the date which in this case would be 29-Feb-1990 and convert it to a date and compare it against the date of Birth and off you go. Well it was fine until today when Oracle tried to convert the date it failed and you have errors all over the place. But this was the easiest thing to do and they did it. Now they can have another four years to fix it.

Comments are closed.