dj at delorie.com (DJ Delorie) writes:
>I currently use this logic in all my software:
> y = get_year();
> y += 2000 if y < 70;
> y += 1900 if y < 200;
>It seems to be able to guess what the year "meant" and gives me the
>right 4-digit number. Substitute "70" for some year that you know
>your data started after. (i.e. none of my `years' are before 1970).
>It means a rewrite of *my* software, but at least I don't have to
>rewrite unix or dos, or rebuild any databases.
Well, applications where you can pull that off are getting more and
more limited. RISKS had an item a few years back about a truant officer
being sent around to find out why "Violet Smith" wasn't in school.
Seems that Ms. Smith had turned 106, and the system (which used code
like yours) assumed she was 6.
Me, I store 4 digit years if I have a choice. And I use longints for
date calculations by converting dates into Julian day numbers.
So unless I get handed data from more than 6000 years back, I'm ok. :-)
Leonard Erickson leonard at qiclab.scn.rain.com
(aka Shadow) shadow at krypton.rain.com (preferred)
FIDO: 1:105/51 Leonard.Erickson at f51.n105.z1.fidonet.org